[FFmpeg-trac] #1349(FFmpeg:closed): itsoffset doesn't work for second input file (audio)

FFmpeg trac at avcodec.org
Fri May 25 20:07:20 CEST 2012


#1349: itsoffset doesn't work for second input file (audio)
------------------------------------+-----------------------------------
             Reporter:  bombo       |                    Owner:
                 Type:  defect      |                   Status:  closed
             Priority:  normal      |                Component:  FFmpeg
              Version:  git-master  |               Resolution:  invalid
             Keywords:  itsoffset   |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------

Comment (by bombo):

 Replying to [comment:2 mjs973]:
 > The -itsoffset option does not work the way you think it does.
 ‘-itsoffset offset (input)’

     Set the input time offset in seconds. [-]hh:mm:ss[.xxx] syntax is also
 supported. The offset is added to the timestamps of the input files.
 Specifying a positive offset means that the corresponding streams are
 delayed by offset seconds.

 (http://ffmpeg.org/ffmpeg.html)
 someone should add *video* there, i thought it would modify *any* 'input
 files'

 > Unless something has changed in the code, the behavior is to add (or
 subtract) a constant value to each *video* timestamp. It never modifies
 audio timestamps.
 >
 > So your command will not work: You must shift the video stream, not try
 to shift the audio stream.
 well ok, so i need to shift the video stream 10s backwards (audio is 10s
 late)
 it works for positive values (forwards):

 Y:\test>ffmpeg -y -itsoffset 00:00:10 -i video.avi -i audio.mp3 -codec
 copy muxed.avi
 ffmpeg version N-40824-g31dfe20 Copyright (c) 2000-2012 the FFmpeg
 developers built on May 19 2012 00:45:59 with gcc 4.6.3  configuration:
 --enable-gpl --ena
 ble-version3 --disable-w32threads --enable-runtime-cpudetect --enable-
 avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt
 --enable-libop
 encore-amrnb --enable-libopencore-amrwb --enable
 -libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-
 libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex
 --enable-li
 btheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc
 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs
 --enable-libxv
 id --enable-zlib
   libavutil      51. 53.100 / 51. 53.100
   libavcodec     54. 21.101 / 54. 21.101
   libavformat    54.  5.100 / 54.  5.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 74.101 /  2. 74.101
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 12.100 /  0. 12.100
   libpostproc    52.  0.100 / 52.  0.100
 Input #0, avi, from 'video.avi':
   Metadata:
     encoder         : Lavf54.5.100
   Duration: 00:01:00.00, start: 0.000000, bitrate: 1237 kb/s
     Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID /
 0x44495658), yuv420p, 720x416 [SAR 1:1 DAR 45:26], 25 tbr, 25 tbn, 25 tbc
 [mp3 @ 0228f040] max_analyze_duration 5000000 reached at 5016000
 Input #1, mp3, from 'audio.mp3':
   Metadata:
     encoder         : Lavf54.5.100
   Duration: 00:01:00.00, start: 0.000000, bitrate: 183 kb/s
     Stream #1:0: Audio: mp3, 48000 Hz, stereo, s16, 192 kb/s
 Output #0, avi, to 'muxed.avi':
   Metadata:
     ISFT            : Lavf54.5.100
     Stream #0:0: Video: mpeg4 (XVID / 0x44495658), yuv420p, 720x416 [SAR
 1:1 DAR 45:26], q=2-31, 25 tbn, 25 tbc
     Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, 192
 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #1:0 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 frame= 1500 fps=0.0 q=-1.0 Lsize=   10476kB time=00:01:00.00
 bitrate=1430.4kbits/s
 video:9020kB audio:1346kB global headers:0kB muxing overhead 1.063745%

 result: audio starts at 00:00:00, video starts at 00:00:10 (10s later)

 but the problem is actually, the audio is 10s late, so i expect negative
 values to do the trick:

 Y:\test>ffmpeg -y -itsoffset -00:00:10 -i video.avi -i audio.mp3 -codec
 copy muxed.avi
 ffmpeg version N-40824-g31dfe20 Copyright (c) 2000-2012 the FFmpeg
 developers built on May 19 2012 00:45:59 with gcc 4.6.3
   configuration: --enable-gpl --enable-version3 --disable-w32threads
 --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-
 frei0r --enable-lib
 ass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb
 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut
 --enable-
 libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex
 --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-
 libvo-amrwbenc
 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs
 --enable-libxvid --enable-zlib
   libavutil      51. 53.100 / 51. 53.100
   libavcodec     54. 21.101 / 54. 21.101
   libavformat    54.  5.100 / 54.  5.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 74.101 /  2. 74.101
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 12.100 /  0. 12.100
   libpostproc    52.  0.100 / 52.  0.100
 Input #0, avi, from 'video.avi':
   Metadata:
     encoder         : Lavf54.5.100
   Duration: 00:01:00.00, start: 0.000000, bitrate: 1237 kb/s
     Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID /
 0x44495658), yuv420p, 720x416 [SAR 1:1 DAR 45:26], 25 tbr, 25 tbn, 25 tbc
 [mp3 @ 0228f040] max_analyze_duration 5000000 reached at 5016000
 Input #1, mp3, from 'audio.mp3':
   Metadata:
     encoder         : Lavf54.5.100
   Duration: 00:01:00.00, start: 0.000000, bitrate: 183 kb/s
     Stream #1:0: Audio: mp3, 48000 Hz, stereo, s16, 192 kb/s
 Output #0, avi, to 'muxed.avi':
   Metadata:
     ISFT            : Lavf54.5.100
     Stream #0:0: Video: mpeg4 (XVID / 0x44495658), yuv420p, 720x416 [SAR
 1:1 DAR 45:26], q=2-31, 25 tbn, 25 tbc
     Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, 192
 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #1:0 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 frame= 1500 fps=0.0 q=-1.0 Lsize=   10470kB time=00:00:50.00
 bitrate=1715.5kbits/s
 video:9020kB audio:1346kB global headers:0kB muxing overhead 1.007220%

 result: audio + video play at the same time, 00:00:00, no delay at all.

 i'm not sure what it is supposed to do with negative values... skip/remove
 the seconds from the video stream?

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1349#comment:4>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list