fixing huge audio-delay
Hi, I'm having trouble with a video: The sound comes to early, roughly 120 seconds, which I can't adjust in mplayer since it only allows 100 seconds difference between audio and video. So I tried fixing with ffmpeg, but I failed. I have tried -itsoffset and -ss, but to no avail. What's wrong? Below is one of my several attemts. Kind regards, Stefan sk at watarrka:/tmp> ffmpeg -y -sameq -i in.mp4 -itsoffset 0:2:0 -i in.mp4 -map 0:0 -map 1:1 foo.mp4 FFmpeg version SVN-r0.5.1-4:0.5.1-3, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --disable-encoder=h263 --disable-encoder=h263p --disable-encoder=mpeg2video --disable-encoder=mpeg4 --disable-encoder=msmpeg4v1 --disable-encoder=msmpeg4v2 --disable-encoder=msmpeg4v3 --extra-version=4:0.5.1-3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdc1394 --enable-shared --disable-static libavutil 49.15. 0 / 49.15. 0 libavcodec 52.20. 1 / 52.20. 1 libavformat 52.31. 0 / 52.31. 0 libavdevice 52. 1. 0 / 52. 1. 0 libavfilter 0. 4. 0 / 0. 4. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Mar 12 2010 21:02:34, gcc: 4.4.3 [mov,mp4,m4a,3gp,3g2,mj2 @ 0xb5f480]multiple edit list entries, a/v desync might occur, patch welcome Seems stream 1 codec frame rate differs from container frame rate: 48.00 (48/1) -> 24.00 (24/1) Last message repeated 1 times Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4': Duration: 01:28:02.95, start: 0.000000, bitrate: 2922 kb/s Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16 Stream #0.1(eng): Video: h264, yuv420p, 1280x720, 24 tbr, 24 tbn, 48 tbc Stream #0.2(eng): Audio: aac, 44100 Hz, stereo, s16 [mov,mp4,m4a,3gp,3g2,mj2 @ 0xb90f00]multiple edit list entries, a/v desync might occur, patch welcome Seems stream 1 codec frame rate differs from container frame rate: 48.00 (48/1) -> 24.00 (24/1) Last message repeated 1 times Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4': Duration: 01:28:02.95, start: 0.000000, bitrate: 2922 kb/s Stream #1.0(eng): Audio: aac, 44100 Hz, stereo, s16 Stream #1.1(eng): Video: h264, yuv420p, 1280x720, 24 tbr, 24 tbn, 48 tbc Stream #1.2(eng): Audio: aac, 44100 Hz, stereo, s16 Output #0, mp4, to 'foo.mp4': Stream #0.0: Video: 0x0000, yuv420p, 1280x720, q=2-31, 200 kb/s, 90k tbn, 24 tbc Stream #0.1: Audio: 0x0000, 44100 Hz, stereo, s16, 64 kb/s Codec type mismatch for mapping #0.0 -> #0.0 sk at watarrka:/tmp> -- Stefan Klinger o/klettern /\/ bis zum send plaintext only - max size 32kB - no spam \ Abfallen http://stefan-klinger.de
Stefan Klinger wrote:
Hi,
I'm having trouble with a video: The sound comes to early, roughly 120 seconds, which I can't adjust in mplayer since it only allows 100 seconds difference between audio and video.
So I tried fixing with ffmpeg, but I failed. I have tried -itsoffset and -ss, but to no avail. What's wrong? Below is one of my several attemts. This page should give you the right info: http://howto-pages.org/ffmpeg/#delay Kind regards, Stefan
sk at watarrka:/tmp> ffmpeg -y -sameq -i in.mp4 -itsoffset 0:2:0 -i in.mp4 -map 0:0 -map 1:1 foo.mp4 Maybe your time-notation should be 00:02:00 instead of 0:2:0 FFmpeg version SVN-r0.5.1-4:0.5.1-3, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --disable-encoder=h263 --disable-encoder=h263p --disable-encoder=mpeg2video --disable-encoder=mpeg4 --disable-encoder=msmpeg4v1 --disable-encoder=msmpeg4v2 --disable-encoder=msmpeg4v3 --extra-version=4:0.5.1-3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdc1394 --enable-shared --disable-static libavutil 49.15. 0 / 49.15. 0 libavcodec 52.20. 1 / 52.20. 1 libavformat 52.31. 0 / 52.31. 0 libavdevice 52. 1. 0 / 52. 1. 0 libavfilter 0. 4. 0 / 0. 4. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Mar 12 2010 21:02:34, gcc: 4.4.3 [mov,mp4,m4a,3gp,3g2,mj2 @ 0xb5f480]multiple edit list entries, a/v desync might occur, patch welcome
Seems stream 1 codec frame rate differs from container frame rate: 48.00 (48/1) -> 24.00 (24/1) Last message repeated 1 times Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4': Duration: 01:28:02.95, start: 0.000000, bitrate: 2922 kb/s Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16 Stream #0.1(eng): Video: h264, yuv420p, 1280x720, 24 tbr, 24 tbn, 48 tbc Stream #0.2(eng): Audio: aac, 44100 Hz, stereo, s16 [mov,mp4,m4a,3gp,3g2,mj2 @ 0xb90f00]multiple edit list entries, a/v desync might occur, patch welcome
Seems stream 1 codec frame rate differs from container frame rate: 48.00 (48/1) -> 24.00 (24/1) Last message repeated 1 times Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4': Duration: 01:28:02.95, start: 0.000000, bitrate: 2922 kb/s Stream #1.0(eng): Audio: aac, 44100 Hz, stereo, s16 Stream #1.1(eng): Video: h264, yuv420p, 1280x720, 24 tbr, 24 tbn, 48 tbc Stream #1.2(eng): Audio: aac, 44100 Hz, stereo, s16 Output #0, mp4, to 'foo.mp4': Stream #0.0: Video: 0x0000, yuv420p, 1280x720, q=2-31, 200 kb/s, 90k tbn, 24 tbc Stream #0.1: Audio: 0x0000, 44100 Hz, stereo, s16, 64 kb/s Codec type mismatch for mapping #0.0 -> #0.0 sk at watarrka:/tmp>
On 03 April 2010, belcampo wrote with possible deletions:
This page should give you the right info: http://howto-pages.org/ffmpeg/#delay
this is exactly what I have tried already. I always see the error message Codec type mismatch for mapping #0.0 -> #0.0 at the very end (see my previous post).
Maybe your time-notation should be 00:02:00 instead of 0:2:0
That don't make any difference. But thanks anyway. Stefan -- Stefan Klinger o/klettern /\/ bis zum send plaintext only - max size 32kB - no spam \ Abfallen http://stefan-klinger.de
Stefan Klinger wrote:
On 03 April 2010, belcampo wrote with possible deletions:
This page should give you the right info: http://howto-pages.org/ffmpeg/#delay
this is exactly what I have tried already. I always see the error message
Codec type mismatch for mapping #0.0 -> #0.0 Sorry overlooked that one.
at the very end (see my previous post).
Maybe your time-notation should be 00:02:00 instead of 0:2:0 shouldn't you add -vcodec copy and -acodec copy ????
That don't make any difference.
But thanks anyway. Stefan
On 03 April 2010, belcampo wrote with possible deletions:
Maybe your time-notation should be 00:02:00 instead of 0:2:0 shouldn't you add -vcodec copy and -acodec copy ????
That's a pretty good idea, since it avoids the lossy recoding. Thanks. However, it don't solve the problem. I've tried something elese: Swapping the mapping as in ffmpeg -y -i in.mp4 -itsoffset 0:2:0.0 -i in.mp4 -vcodec copy -acodec copy -map 0:1 -map 1:0 out.mp4 don't show the error message any more, but also the audio stream is *not* delayed in the generated output file. Any more suggestions? Thank you! Stefan -- Stefan Klinger o/klettern /\/ bis zum send plaintext only - max size 32kB - no spam \ Abfallen http://stefan-klinger.de
Ok, by trial-and-error I've found a solution to fix the audio-delay. -itsoffset is *not* involved. Instead I use -ss to cut off the leading 2 minutes of the video stream. The important point, however, is to use the proper mapping: ffmpeg -y -ss 120.0 -i in.mp4 -i in.mp4 -map 0:1 -map 1:0 -acodec copy -vcodec copy out.mp4 Without the two -map options, this won't work. The -acodec and -vcodec options omit recoding which means speedup and better quality. This solution, however, will not work if you want to keep the leading part of the original video stream, just without audio. -- Stefan Klinger o/klettern /\/ bis zum send plaintext only - max size 32kB - no spam \ Abfallen http://stefan-klinger.de
On ma, 2010-04-05 at 12:27 +0200, Stefan Klinger wrote:
Ok, by trial-and-error I've found a solution to fix the audio-delay. -itsoffset is *not* involved. Instead I use -ss to cut off the leading 2 minutes of the video stream. The important point, however, is to use the proper mapping: ffmpeg -y -ss 120.0 -i in.mp4 -i in.mp4 -map 0:1 -map 1:0 -acodec copy -vcodec copy out.mp4 Without the two -map options, this won't work. The -acodec and -vcodec options omit recoding which means speedup and better quality. This solution, however, will not work if you want to keep the leading part of the original video stream, just without audio.
Nice :-) I've had similar problems, and I resorted to manually (well, in a script) decoding video and audio, trimming a bit off from the front if necessary to regain a/v sync and the trim a bit of the back to make both streams equal in length. It seems your solution does all in one go ;-) What happens if you leave out the "map" statements? Does it cut the wrong stream?
On 5 April 2010 11:33, Erik Slagter <erik at slagter.name> wrote:
On ma, 2010-04-05 at 12:27 +0200, Stefan Klinger wrote:
Ok, by trial-and-error I've found a solution to fix the audio-delay. -itsoffset is *not* involved. Instead I use -ss to cut off the leading 2 minutes of the video stream. The important point, however, is to use the proper mapping: ? ffmpeg -y -ss 120.0 -i in.mp4 -i in.mp4 -map 0:1 -map 1:0 -acodec copy -vcodec copy out.mp4 Without the two -map options, this won't work. The -acodec and -vcodec options omit recoding which means speedup and better quality. This solution, however, will not work if you want to keep the leading part of the original video stream, just without audio.
Nice :-)
I've had similar problems, and I resorted to manually (well, in a script) decoding video and audio, trimming a bit off from the front if necessary to regain a/v sync and the trim a bit of the back to make both streams equal in length.
It seems your solution does all in one go ;-)
What happens if you leave out the "map" statements? Does it cut the wrong stream?
For info I've always had more success transcoding to mpeg1/2 when I have to fix sync, for some reason avi doesnt always take. YMMV
Hello, I convert with success from .ts to .mpeg with the following line: ffmpeg -i Hero1.ts -sameq -sn salida.mpeg Is reproduced OK in VLC and media disk. Original file: Hero1.ts is about 28 minutes; but the converted file salida.mpeg when reproduced in media disk it shows that length is 14 seconds. Why this happens? and how could be solved? Thank you Victor
participants (5)
-
all-lists@stefan-klinger.de -
belcampo@zonnet.nl -
erik@slagter.name -
redtux1@googlemail.com -
victor@eurovip.es