I have OTA recordings (WTV--> MPG) which are then converted to avi that are out of sync (DGIndex confirms that the mpg audio has a positive delay).
VLC and MPC bring it into sync using a positive value of 250.
There is a method of syncing using a command line in ffmpeg that seems to work when the delay is negative.
http://alien.slackbook.org/blog/fixing-audio-sync-with-ffmpeg/
It doesn't seem to work for positive delays.ffmpeg -i bbt.avi -itsoffset 0.25 -i bbt.avi -map 0:v -map 1:a -vcodec copy -acodec copy insync.avi
Any ideas?
+ Reply to Thread
Results 1 to 6 of 6
-
-
How are you converting the MPG to AVI? Maybe there's a chance to remove the delay at that step?
Otherwise try remuxing using AVI Mux GUI or try a different output container (e.g. mkv). -
@pandy, if I change the .25 to -.25, the result when played back with MPC is that I have to give it a positive delay of 500m/s.
@sneaker, A batch file using Staxrip is used to convert the mpg files (I think it uses information from DGIndex, so would it expect it to know that the delay was positive? - in any case it's the same settings for other mpg files that have negative delays and they play ok when converted).
I take it you mean take the avi file with the positive delay and put it in an mkv container then try the command line.
I'll try it. -
Delays in AVI can be a bit problematic and I don't think ffmpeg will do them in a good way (or at all?) while in copy mode. Hence my suggestions.
No, I meant outputting to mkv from ffmpeg.
I cannot say much about StaxRip, at least not without a complete log. But to me it would make more sense to fix it there, if only to avoid the hassle of doing additional post-processing in e.g. ffmpeg. In an AviSynth based process it would be easiest to either add Trim() to the video script or DelayAudio() to the audio script before the encoding happens.
What AVI Mux GUI can do to some extend is fix borked AVI delays by replacing the "delay" by real silence encoded in the audio format. There are similar softwares to do that like delaycut. But if ffmpeg does not apply delay to avi in copy mode at all this is futile anyway.
Luckily, AVI Mux GUI can (properly) delay the audio by itself so you don't need ffmpeg at all. -
ffmpeg chokes trying to output to mkv.
If I convert the avi to mkv using MKVGui then use ffmpeg on the mkv source it also fails with the same message.
This problem only shows up with The Big Bang Theory and I don't want to get into rewriting the bat file for this particular run of recordings so I will just continually to do them individually in VirtualDub.
Thanks to you both for the suggestions.
Cheers.
ffmpeg -i bbt.avi -itsoffset 0.25 -i bbt.avi -map 0:v -map 1:a -vcodec copy -acodec copy insync.mkv[matroska @ 0517df20] Timestamps are unset in a packet for stream 0. This is dep
recated and will stop working in the future. Fix your code to set the timestamps
properly
[matroska @ 0517df20] Can't write packet with unknown timestamp
av_interleaved_write_frame(): Invalid argument
Similar Threads
-
FFMPEG -F Concat Video, Audio Sync Issue
By Shohag_ifas in forum EditingReplies: 2Last Post: 30th Nov 2016, 01:31 -
ffmpeg sync - dither, strech, audio stream to match the timestamps-asnync=1
By logicom in forum Video ConversionReplies: 0Last Post: 2nd Nov 2014, 11:51 -
x264+AAC in FFmpeg -- plays fine in FFplay, loses sync in mplayer
By rusmichal in forum Video ConversionReplies: 2Last Post: 6th Apr 2013, 07:52 -
audio is out of sync after conversion with ffmpeg
By gil900 in forum RestorationReplies: 30Last Post: 29th Mar 2013, 18:38 -
DVD Flick / Ffmpeg Sync Issues
By vhman in forum Authoring (DVD)Replies: 1Last Post: 24th Jan 2013, 17:55