[FFmpeg-user] Delay of one audio track makes it track played last among others?

Francois Visagie francois.visagie at gmail.com
Mon Sep 2 09:45:55 CEST 2013


> -----Original Message-----
> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
> bounces at ffmpeg.org] On Behalf Of Andrey Aleksandrovich
> Sent: 31 August 2013 15:17
> To: FFmpeg user questions
> Subject: [FFmpeg-user] Delay of one audio track makes it track played last
> among others?
> 
> Hello,
> I need to make DVD compatible mpg file. I already have video with English
> track (1.mpg). And I have Rus.mp2 - Russian track, which needs delaying
(330
> ms).
> If I do this:
> ffmpeg -y -itsoffset 0.33 -i Rus.mp2 -i 1.mpg -vcodec copy -acodec copy
-map
> 1:0 -map 0:0 -map 1:1 -f dvd final.vob ffmpeg version 1.0.7 Copyright (c)
2000-
> 2013 the FFmpeg developers
>   built on Jul 15 2013 10:59:09 with gcc 4.6.3 (Gentoo Hardened 4.6.3
p1.13,
> pie-0.5.2)
>   configuration: --prefix=/usr --libdir=/usr/lib64
> --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-
> pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar
> --optflags='-O2 -pipe -march=native'
> --extra-cflags='-O2 -pipe -march=native' --extra-cxxflags='-O2 -pipe -
> march=native' --disable-static --enable-gpl --enable-version3 --enable-
> postproc --enable-avfilter --enable-avresample --disable-stripping
--disable-
> debug --disable-doc --disable-network --disable-vaapi --disable-runtime-
> cpudetect --enable-libmp3lame --enable-libvo-amrwbenc --enable-libtheora
> --enable-libx264 --enable-libxvid --disable-indev=v4l2 --disable-indev=oss
--
> disable-indev=jack --enable-x11grab --disable-outdev=oss --enable-libass
--
> enable-libfreetype --enable-pthreads --enable-libopencore-amrwb --
> enable-libopencore-amrnb --enable-libvorbis --enable-libvpx --enable-
> libopenjpeg --disable-altivec --disable-avx --disable-ssse3 --disable-vis
--
> disable-neon --cpu=host --enable-hardcoded-tables
>   libavutil      51. 73.101 / 51. 73.101
>   libavcodec     54. 59.100 / 54. 59.100
>   libavformat    54. 29.104 / 54. 29.104
>   libavdevice    54.  2.101 / 54.  2.101
>   libavfilter     3. 17.100 /  3. 17.100
>   libswscale      2.  1.101 /  2.  1.101
>   libswresample   0. 15.100 /  0. 15.100
>   libpostproc    52.  0.100 / 52.  0.100
> [mp3 @ 0x503590c5e0] max_analyze_duration 5000000 reached at 5016000
> [mp3 @ 0x503590c5e0] Estimating duration from bitrate, this may be
> inaccurate Input #0, mp3, from 'Rus.mp2':
>   Duration: 01:23:57.88, start: 0.000000, bitrate: 128 kb/s
>     Stream #0:0: Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s [mpeg @
> 0x503590cde0] max_analyze_duration 5000000 reached at 5005000 Guessed
> Channel Layout for  Input Stream #1.1 : stereo Input #1, mpeg, from
'1.mpg':
>   Duration: 01:23:57.86, start: 0.300300, bitrate: 6921 kb/s
>     Stream #1:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR
8:9
> DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
>     Stream #1:1[0xa0]: Audio: pcm_s16be, 48000 Hz, stereo, s16, 1536 kb/s
> Output #0, dvd, to 'f.vob':
>   Metadata:
>     encoder         : Lavf54.29.104
>     Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 8:9 DAR 4:3],
q=2-
> 31, 8000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
>     Stream #0:1: Audio: mp2, 48000 Hz, stereo, 128 kb/s
>     Stream #0:2: Audio: pcm_s16be, 48000 Hz, stereo, 1536 kb/s Stream
> mapping:
>   Stream #1:0 -> #0:0 (copy)
>   Stream #0:0 -> #0:1 (copy)
>   Stream #1:1 -> #0:2 (copy)
> Press [q] to stop, [?] for help
> frame=150986 fps=593 q=-1.0 Lsize= 4357134kB time=01:23:58.21
> bitrate=7084.6kbits/s video:3246391kB audio:1023318kB subtitle:0 global
> headers:0kB muxing overhead 2.047583%
> 
> I get the final.vob file with proper delaying and mapping (1st Russian,
2nd
> English) according to mediainfo. But 'ffmpeg -i' said that Russian is
second
> and all Players show the same (playing video -> first is English).
> 
> Why it is happened?

If I understand your description correctly, your output got encoded the way
you wanted it to, but ffmpeg reports otherwise. I suspect you've run into an
example of how ffmpeg picks the "best" stream for processing:
http://www.ffmpeg.org/ffmpeg-all.html#Stream-selection



More information about the ffmpeg-user mailing list