Pergunta

When I call

frame_size = x264_encoder_encode(encoder, &nals, &i_nals, &pic_in, &pic_out);

and subsequently write each NAL to a file like this:

     if (frame_size >= 0)
     {
        int i;
        int j;

        for (i = 0; i < i_nals; i++)
        {
           printf("******************* NAL %d (%d bytes) *******************\n", i, nals[i].i_payload);
           fwrite(&(nals[i].p_payload[0]), 1, nals[i].i_payload, fid);
        }
     }

then I get this

Beginning of NAL file

My questions are:

1) Is it normal that there's readable parameters in the beginning of the file?

2) How do I configure the X264 encoder so that the encoder returns frames that I can send via UDP without the packet getting fragmented (size must be below 1390 or somewhere around that).

3) With the x264.exe I pass in these options:

"--threads 1 --profile baseline --level 3.2 --preset ultrafast --bframes 0 --force-cfr --no-mbtree --sync-lookahead 0 --rc-lookahead 0 --keyint 1000 --intra-refresh" 

How do I map those to the settings in the X264 parameters structure ? (x264_param_t)

4) I have been told that the x264 static library doesn't support bitmap input to the encoder and that I have to use libswscale for conversion of the 24bit RGB input bitmap to YUV2. The encoder, supposedly, only takes YUV2 as input? Is this true? If so, how do I build libswscale for the x264 static library?

Foi útil?

Solução

1) Yes. x264 includes the automatically. Its an SEI slice, and you can throw it away if you want.

2) set i_slice_max_size = 1390

3) Take a look at x264_param_t in x264.h. The settings are fairly self explanatory. As for setting the profile and preset call int x264_param_apply_profile( x264_param_t *, const char *profile ) and int x264_param_default_preset( x264_param_t *, const char *preset, const char *tune )

4) Yes, it is true, I want lying when I said that. Look online/on stack overflow there are a million resources on compiling ffmpeg. In fact if you compiled x264 with avcodec support you already have it on your system.

5) Yes!, you should be a good stack overflow citizen and up vote and accept answers form people who donate there free time and knowledge (which takes years to acquire) to helping you.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top