On 07/08/17 20:24, Jorge Ramirez wrote:
> On 08/03/2017 01:53 AM, Mark Thompson wrote:
>>> +    default:
>>> +        return 0;
>>> +    }
>>> +
>>> +    SET_V4L_EXT_CTRL(value, qmin, avctx->qmin, "minimum video quantizer 
>>> scale");
>>> +    SET_V4L_EXT_CTRL(value, qmax, avctx->qmax, "maximum video quantizer 
>>> scale");
>>> +
>>> +    return 0;
>>> +}
>> This doesn't set extradata - you need to extract the codec global headers 
>> (such as H.264 SPS and PPS) at init time to be able to write correct files 
>> for some codecs (such as H.264) with muxers requiring global headers (such 
>> as MP4).  It kindof works without it, but the files created will not conform 
>> and will not be usable on some players.
>>
> ah that might explain some things (when I play back the encoded video the 
> quality is pretty lousy)
> is there already some code I can use as a reference? I might be out of my 
> depth here so any help will be more than welcome

Methods used by other codecs to extract the headers:

Something to call directly to get them:
* x264_encoder_headers in libx264: 
<http://git.videolan.org/?p=x264.git;a=blob;f=x264.h#l895>.
* nvEncGetSequenceParams in nvenc: 
<http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/nvenc.c;h=f79b9a502e33c66e62513c56e54e9cec041e9d45;hb=HEAD#l1282>.

They appear on the front of the stream and can be read from there at init time:
* OMX_BUFFERFLAG_CODECCONFIG in OpenMAX IL: 
<http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/omx.c;h=19b4f33836b68fabe7be921ca959c619dd28e535;hb=HEAD#l685>.

Know the answer magically in advance (probably not applicable here):
* VAAPI makes the user write their own headers, so we can just write those to 
the extradata directly as well: 
<http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/vaapi_encode.c;h=2de5f76cabf329c92272627ee13ab3c8689806d3;hb=HEAD#l1471>.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to