[MEncoder-users] Remux a dvd into an .mpg container

L. Lee llee040 at sbcglobal.net
Sat Oct 27 23:19:37 CEST 2012


I didn't see this among the solutions offered, but if the offset between
audio and video is consistent (doesn't increase or decrease through the
duration), you might be able to apply adelay and vdelay options for
mpegopts: vdelay=(number of milliseconds) or (adelay=number of
milliseconds). If the duration of processed audio varies from that of
processed video, the only remedy I've found is to apply one of two values
for -mc:  0 or 0.1. If neither of those fixes it, then I use a pipe method
to make ffmpeg send the audio to soX for a tempo change then get it back
again to output as ac3, then apply adelay or vdelay as needed when remuxing.
That method was contributed on this list a couple of years ago by Socke. It
goes something like this:


ffmpeg -v 0 -i input.ac3 -f sox - | sox -S -V -p -p tempo 1.00005 | ffmpeg
-v 0 -i - -acodec ac3 -ab 448000 -y output.ac3


Here's how to calculate that tempo change value (1.00005 above). Get the
total duration in milliseconds from mediainfo.


mediainfo -f file.mpg  | grep -m 1 Duration

Then you have to get the value of the drift between audio and video in
milliseconds. To do that you can use mplayer to adjust offset in real time
while auditioning the video you ripped. You can change it in 100-millisecond
increments using keys on the keyboard (finer adjustment is possible in the
calculations, but in my experience, it's a preference that is quite
subjective for most content). On my keyboard, it's alt with "[" or "]". You
have to calculate the difference between audio offset needed near the
beginning and audio offset needed near the end (subtract). Then substitute
that value in the calculation of the required tempo change, which is the
total duration divided by the difference between total duration and overall
offset value. The method requires that the audio sync drift in relation to
video remains continuous, of course. If the audio drifts sporadically,
naturally it won't work. This appears to work for increasing or decreasing
audio tempo provided that you specify correct positive or negative
designation for the value in the calculation. In case you couldn't tell, I'm
no mathematician.



Yours 'til I am,

Laine Lee






http://article.gmane.org/gmane.comp.video.mencoder.user/10563/

On 9/21/12 10:20 AM, "Steven Miller" <stevenraymillerjr at gmail.com> wrote:

> I am trying to remux a commerical dvd into an mpg container for use with
> windows media center and xbox. These options get me 99% of the way there.
> 
> mencoder.exe -dvd-device .\foobar dvd://1 -ovc copy -oac copy -noskip -mc
> 0
> -of mpeg
> -mpegopts format=dvd:tsaf:muxrate=12200 -o foobar.mpg
> 
> The only problem is that there is an a/v sync issue where the audio is
> about 5 seconds behind the video.
> 
> Things worth noting;
> 
> Omiting "tsaf" from "-mpegopts" results in jerky video.
> 
> Both "format=dvd" and "format=mpeg2" share the same results.
> 
> "muxrate=12200" was added to resolve buffer underruns.
> 
> I've tried "-ofps 24000/1001" and the "-mpegopts" option
> "vframerate=24000/1001". It doesn't affect the a/v sync issue.
> 
> Mencoder version: MEncoder Sherpya-SVN-r34401-4.6.2
> 
> OS: Windows 7 Home Premium
> 
> Thoughts?
> 
> Thanks,
> 
> Steve
> _______________________________________________
> MEncoder-users mailing list
> MEncoder-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users





More information about the MEncoder-users mailing list