[FFmpeg-devel] [PATCH] fix wrong framerate set on stream copy

Maksym Veremeyenko verem
Mon Jan 17 10:32:06 CET 2011


Hi,

during remuxing QUICKTIME file to AVI i found that reasulting AVI files 
has frame-rate 600fps.

remuxing command:

[root at story-parts ffmpeg-r26398]# ./ffmpeg_g -i video/G0000077.mov 
-vcodec copy -acodec pcm_s16le -y video/G0000077.avi
FFmpeg version SVN-r26398, Copyright (c) 2000-2011 the FFmpeg developers
   built on Jan 17 2011 11:03:25 with gcc 4.5.1 20100924 (Red Hat 4.5.1-4)
   configuration: --prefix=/usr/local/enctools 
--extra-cflags=-I/usr/local/enctools/include 
--extra-ldflags=-L/usr/local/enctools/lib --enable-shared --enable-gpl 
--enable-version3 --enable-nonfree --enable-postproc --enable-avfilter 
--enable-pthreads --enable-bzlib --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame 
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 
--enable-libxvid --enable-zlib
   libavutil     50.36. 0 / 50.36. 0
   libavcore      0.16. 1 /  0.16. 1
   libavcodec    52.108. 0 / 52.108. 0
   libavformat   52.93. 0 / 52.93. 0
   libavdevice   52. 2. 3 / 52. 2. 3
   libavfilter    1.74. 0 /  1.74. 0
   libswscale     0.12. 0 /  0.12. 0
   libpostproc   51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video/G0000077.mov':
   Metadata:
     creation_time   : 2007-10-04 13:30:59
   Duration: 00:00:04.96, start: 0.000000, bitrate: 18 kb/s
     Stream #0.0(eng): Video: dvvideo, yuv420p, 720x576 [PAR 64:45 DAR 
16:9], 28800 kb/s, 25 fps, 25 tbr, 600 tbn, 25 tbc
     Metadata:
       creation_time   : 2007-10-04 13:35:20
     Stream #0.1(eng): Audio: pcm_s24be, 48000 Hz, 2 channels, s32, 2304 
kb/s
     Metadata:
       creation_time   : 2007-10-04 13:35:20
     Stream #0.2(eng): Data: tmcd / 0x64636D74, 0 kb/s
     Metadata:
       creation_time   : 2007-10-04 13:35:20
Output #0, avi, to 'video/G0000077.avi':
   Metadata:
     creation_time   : 2007-10-04 13:30:59
     ISFT            : Lavf52.93.0
     Stream #0.0(eng): Video: dvvideo, yuv420p, 720x576 [PAR 64:45 DAR 
16:9], q=2-31, 28800 kb/s, 600 tbn, 600 tbc
     Metadata:
       creation_time   : 2007-10-04 13:35:20
     Stream #0.1(eng): Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 
kb/s
     Metadata:
       creation_time   : 2007-10-04 13:35:20
Stream mapping:
   Stream #0.0 -> #0.0
   Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=  124 fps=  0 q=-1.0 Lsize=   18452kB time=4.92 
bitrate=30713.4kbits/s
video:17438kB audio:930kB global headers:0kB muxing overhead 0.461519%

Source Quicktime files's timebase is 600. As result condition 
av_q2d(ist->st->time_base) < 1.0/1000 is false and that cause output 
codec timebase is set to input stream timebase, i.e. 600 (ffmpeg.c:2147):
[...]
             if(!copy_tb && 
av_q2d(icodec->time_base)*icodec->ticks_per_frame > 
av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000){
                 codec->time_base = icodec->time_base;
                 codec->time_base.num *= icodec->ticks_per_frame;
                 av_reduce(&codec->time_base.num, &codec->time_base.den,
                           codec->time_base.num, codec->time_base.den, 
INT_MAX);
             }else
                 codec->time_base = ist->st->time_base;
[...]

as result AVI stream header's dwScale/dwRate stored 1/600.

To fix this behavior please revert r6920.

Patch attached.

-- 
________________________________________
Maksym Veremeyenko

-------------- next part --------------
A non-text attachment was scrubbed...
Name: revert_r6920.patch
Type: text/x-patch
Size: 787 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110117/281172d2/attachment.bin>



More information about the ffmpeg-devel mailing list