[FFmpeg-devel] [PATCH] Implement in lavc a flag which makes avcodec_open() to choose the best framerate

Stefano Sabatini stefano.sabatini-lala
Wed Aug 20 02:31:22 CEST 2008


On date Saturday 2008-08-09 18:50:24 +0200, Michael Niedermayer encoded:
> On Sat, Aug 09, 2008 at 04:12:29PM +0200, Stefano Sabatini wrote:
> > Hi all,
> > 
> > I think this feature should go in lavc, also I think it shouldn't be
> > enabled by default but let the user to explicitly set it.
> 
> rejected
> the code could be put into a new function that applications can explixitly
> call if they want ...

Do you mean like in the attached patch?

Or do you mean to use the new function:
avcodec_set_best_framerate(AVCodecContext *avctx, AVCodec *codec);

in avcodec_open(), so keeping the choose_best_framerate flag?

I still continue to prefer the solution which uses a flag in the codec
context rather than in the application, which looks less cluttered.

Usage example:

stefano at geppetto ~/s/ffmpeg> ffmpeg -i ~/test.flv -r 42.42 -vcodec mpeg1video -y test.mpeg
FFmpeg version SVN-r14856, Copyright (c) 2000-2008 Fabrice Bellard, et al.
[...]
Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from '/home/stefano/test.flv':
  Duration: 00:00:30.01, start: 0.000000, bitrate: 96 kb/s
    Stream #0.0: Video: vp6f, yuv420p, 320x240, 25.00 tb(r)
    Stream #0.1: Audio: mp3, 44100 Hz, mono, s16, 96 kb/s
Output #0, mpeg, to 'test.mpeg':
    Stream #0.0: Video: mpeg1video, yuv420p, 320x240, q=2-31, 200 kb/s, 42.42 tb(c)
    Stream #0.1: Audio: mp2, 44100 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
[mpeg1video @ 0x8790da0]MPEG1/2 does not support 2121/50 fps
Error while opening codec for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height

stefano at geppetto ~/s/ffmpeg> 
ffmpeg -i ~/test.flv -r 42.42 -choose_best_framerate -vcodec mpeg1video -y test.mpeg
FFmpeg version SVN-r14856, Copyright (c) 2000-2008 Fabrice Bellard, et al.
[...]
Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from '/home/stefano/test.flv':
  Duration: 00:00:30.01, start: 0.000000, bitrate: 96 kb/s
    Stream #0.0: Video: vp6f, yuv420p, 320x240, 25.00 tb(r)
    Stream #0.1: Audio: mp3, 44100 Hz, mono, s16, 96 kb/s
Output #0, mpeg, to 'test.mpeg':
    Stream #0.0: Video: mpeg1video, yuv420p, 320x240, q=2-31, 200 kb/s, 50.00 tb(c)
    Stream #0.1: Audio: mp2, 44100 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1

Regards.
-- 
FFmpeg = Friendly and Fiendish Meaningless Problematic Eretic Gangster
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implement-avcodec-set-best-framerate-00.patch
Type: text/x-diff
Size: 2151 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080820/dba3ffa7/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implement-best-possible-framerate-00.patch
Type: text/x-diff
Size: 2118 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080820/dba3ffa7/attachment-0001.patch>



More information about the ffmpeg-devel mailing list