[Ffmpeg-devel] Post processing of codecs which require it.

Michael Niedermayer michaelni
Sat Feb 4 02:32:39 CET 2006


On Fri, Feb 03, 2006 at 07:07:09PM -0500, Debabrata Banerjee wrote:
> Short explanation: I believe that avcodec_decode_video is incomplete
> Long explanation: I started out by trying to add a decoding feature to 
> MythTV. For a long time now MythTV mpeg-4 playback has not had 
> post-processing at all. This results in very nasty macroblocking, even at 
> high-bit rates - which were really unnecessary if post-processed correctly. 
> It does have it's own filter-plugin mechanism, however only raw frames are 
> available to the output filter. Qscale_table and qstride are really 
> necessary in order to properly post-process and mpeg-4 frame. There was an 
> effort more than a year ago to push these out with each frame into the 
> buffer and then into the filter plugins - and it never worked. So I sat 
> down and decided to try and fix this, except I wasn't going to bother 
> trying to buffer these values, but rather post-process directly after the 
> decoded frame was received as it was codec specific -who wants to (or 
> should) deblock/dering mpeg2/rtjpeg/HD/etc video?? Having never seen 

well, i do sometimes ...

> exactly how this is done and with little documentation, I noticed there are 
> a lot of internal variables that I shouldn't really have to be concerned 
> with or know what they do when using ffmpeg as a library. The call should 
> be simple and abstract. I believe when you call avcodec_decode_video() to 
> get a frame, this frame should be _fully processed_ when you get it back,

NO! avcodec_decode_video() decodes the video, postprocessing is a seperate
thing, not only conceptually but also implementation wise

theres nothing wrong with adding avcodec_decode_and_process_video() though
if you want to contribute something ...

> and the proper place to make a code change is not MythTV, but ffmpeg. Right 
> now conceptually we are only getting half-decoded frames back, as mpeg-4 
> decoding involves a post-processing stage to really be mpeg-4. This applies 
> to all the other codecs that need post-processing as well.

post-processing is not part of mpeg-anything, sorry its a non-normative thing
you can if you want do after decoding (dont hesitate to look it up in the mpeg
vido spec if you dont agree)

> What do you guys think?

i would suggest you look at mplayers vd_ffmpeg.c and vf_pp.c maybe ...

> Also if you disagree - it would be nice to update api_example.c with how to 
> do this properly for us n00bs :)

yes it would be nice, patch welcome :)


More information about the ffmpeg-devel mailing list