[FFmpeg-devel] [PATCH] fix stream copy

Michael Niedermayer michaelni
Thu Jan 14 16:27:09 CET 2010


On Thu, Jan 14, 2010 at 01:34:02PM +0200, Maksym Veremeyenko wrote:
> Maksym Veremeyenko ???????(??):
> [...]
>> So the only idea to find solution is to check if read and written packets 
>> has proper pts values.
> i think i was on right path :-)
> attached patch fix a problem.
>
> BEFORE:
>
> [root at diva-proxy ffmpeg-r21211]# /home/enctools/bin/ffmpeg -i 
> /home/diva/1/3/snoop_dog_105_d.mov -t 1.0 -an -vcodec copy -y 
> /home/diva/1/3/CUT_t10_snoop_dog_105_d.mov
> FFmpeg version SVN-r21010, Copyright (c) 2000-2010 Fabrice Bellard, et al.
>   built on Jan  4 2010 11:21:04 with gcc 4.3.2 20081105 (Red Hat 4.3.2-7)
>   configuration: --prefix=/home/enctools --enable-libfaac --enable-libfaad 
> --enable-libmp3lame --enable-postproc --enable-pthreads --enable-libx264 
> --enable-libxvid --extra-cflags=-I/home/enctools/include 
> --extra-ldflags=-L/home/enctools/lib --enable-shared --enable-gpl 
> --enable-nonfree --enable-avfilter --enable-avfilter-lavf
>   libavutil     50. 7. 0 / 50. 7. 0
>   libavcodec    52.45. 0 / 52.47. 0
>   libavformat   52.46. 0 / 52.46. 0
>   libavdevice   52. 2. 0 / 52. 2. 0
>   libavfilter    1.13. 0 /  1.15. 0
>   libswscale     0. 7. 2 /  0. 8. 0
>   libpostproc   51. 2. 0 / 51. 2. 0
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
> '/home/diva/1/3/snoop_dog_105_d.mov':
>   Duration: 00:03:02.28, start: 0.000000, bitrate: 30336 kb/s
>     Stream #0.0(eng): Video: dvvideo, yuv420p, 720x576, 28800 kb/s, PAR 
> 767:720 DAR 767:576, 25 fps, 25 tbr, 600 tbn, 25 tbc
>     Stream #0.1(eng): Audio: pcm_s16be, 48000 Hz, 2 channels, s16, 1536 
> kb/s
> Output #0, mov, to '/home/diva/1/3/CUT_t10_snoop_dog_105_d.mov':
>     Stream #0.0(eng): Video: dvvideo, yuv420p, 720x576 [PAR 212:199 DAR 
> 265:199], q=2-31, 28800 kb/s, 600 tbn, 600 tbc
> Stream mapping:
>   Stream #0.0 -> #0.0
> Press [q] to stop encoding
> frame=  600 fps=  0 q=-1.0 Lsize=   84378kB time=23.96 
> bitrate=28847.1kbits/s
> video:84375kB audio:0kB global headers:0kB muxing overhead 0.003558%
>
> AFTER:
>
> [root at diva-proxy ffmpeg-r21211]# ./ffmpeg_g -i 
> /home/diva/1/3/snoop_dog_105_d.mov -t 1.0 -an -vcodec copy -y 
> /home/diva/1/3/CUT_t10_snoop_dog_105_d.mov
> FFmpeg version SVN-r21211, Copyright (c) 2000-2010 Fabrice Bellard, et al.
>   built on Jan 14 2010 13:16:31 with gcc 4.3.2 20081105 (Red Hat 4.3.2-7)
>   configuration: --prefix=/home/enctools --enable-libfaac --enable-libfaad 
> --enable-libmp3lame --enable-postproc --enable-pthreads --enable-libx264 
> --enable-libxvid --extra-cflags='-I/home/enctools/include -DDEBUG' 
> --extra-ldflags=-L/home/enctools/lib --enable-shared --enable-gpl 
> --enable-nonfree --enable-avfilter --enable-avfilter-lavf --enable-debug=3
>   libavutil     50. 7. 0 / 50. 7. 0
>   libavcodec    52.47. 0 / 52.47. 0
>   libavformat   52.46. 0 / 52.46. 0
>   libavdevice   52. 2. 0 / 52. 2. 0
>   libavfilter    1.15. 0 /  1.15. 0
>   libswscale     0. 8. 0 /  0. 8. 0
>   libpostproc   51. 2. 0 / 51. 2. 0
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
> '/home/diva/1/3/snoop_dog_105_d.mov':
>   Duration: 00:03:02.28, start: 0.000000, bitrate: 30336 kb/s
>     Stream #0.0(eng): Video: dvvideo, yuv420p, 720x576, 28800 kb/s, PAR 
> 767:720 DAR 767:576, 25 fps, 25 tbr, 600 tbn, 25 tbc
>     Stream #0.1(eng): Audio: pcm_s16be, 48000 Hz, 2 channels, s16, 1536 
> kb/s
> Output #0, mov, to '/home/diva/1/3/CUT_t10_snoop_dog_105_d.mov':
>     Stream #0.0(eng): Video: dvvideo, yuv420p, 720x576 [PAR 212:199 DAR 
> 265:199], q=2-31, 28800 kb/s, 600 tbn, 600 tbc
> Stream mapping:
>   Stream #0.0 -> #0.0
> Press [q] to stop encoding
> frame=   25 fps=  0 q=-1.0 Lsize=    3516kB time=0.96 
> bitrate=29954.4kbits/s
> video:3516kB audio:0kB global headers:0kB muxing overhead 0.021500%
>
> After the patch NTSC mov files starts to cut in proper duration.
>
> -- 
> ________________________________________
> Maksym Veremeyenko

>  ffmpeg.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> e914c6ff6a9ee7fb75cecf6f7cd01b69f1186666  ffmpeg_sync_opts_value_fix.patch
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 21211)
> +++ ffmpeg.c	(working copy)
> @@ -1477,7 +1477,7 @@
>                              audio_size += data_size;
>                          else if (ost->st->codec->codec_type == CODEC_TYPE_VIDEO) {
>                              video_size += data_size;
> -                            ost->sync_opts++;
> +                            ost->sync_opts += pkt->duration;

sync_opts and pkt->duration can be in diferent units so this cant be correct

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100114/dd023a58/attachment.pgp>



More information about the ffmpeg-devel mailing list