Subtitles with Ffmpeg
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
-
- Posts: 2
- Joined: Wed Oct 24, 2012 9:37 pm
Subtitles with Ffmpeg
For absolutely ages I have been having trouble with certain mkv files not syncing the video and audio and it seems this problem has been solved if I use ffmpeg.
Does anyone know how to get subs working with ffmpeg? I get an error if I try to run avisynth/ffmpeg as I though that may work.
Any help would be appreciated!
Does anyone know how to get subs working with ffmpeg? I get an error if I try to run avisynth/ffmpeg as I though that may work.
Any help would be appreciated!
- SharkHunter
- Developer
- Posts: 648
- Joined: Fri Jun 01, 2012 9:36 pm
Re: Subtitles with Ffmpeg
That depends on. You could simply doNaughtyPrawn wrote:For absolutely ages I have been having trouble with certain mkv files not syncing the video and audio and it seems this problem has been solved if I use ffmpeg.
Does anyone know how to get subs working with ffmpeg? I get an error if I try to run avisynth/ffmpeg as I though that may work.
Any help would be appreciated!
Code: Select all
ffmpeg -i file.xyz -i subs.??? out.abc
This is simply not supported in ffmpeg. If your render supports srt the above should work otherwise you could use mencoder or use some pipeing and use spumux. I have on the to do list (probably at the bottom) to get ffmpeg to support srts when transcoding to mpeg2.
We reject: kings, presidents and voting.
We believe in: rough consensus and running code.
We believe in: rough consensus and running code.
-
- Posts: 2
- Joined: Wed Oct 24, 2012 9:37 pm
Re: Subtitles with Ffmpeg
Yeah doesn't seem like it will work. Is there any way to get mencoder to keep the audio and video in sync like ffmpeg does? Sorry I'm pretty new to all this 

- SharkHunter
- Developer
- Posts: 648
- Joined: Fri Jun 01, 2012 9:36 pm
Re: Subtitles with Ffmpeg
Like always synch is all in the eye of the beholder. But you could try the "-mc" option and play with the values start on 0.1
From the man page
From the man page
Code: Select all
mc <seconds/frame>
maximum A-V sync correction per frame (in seconds)
-mc 0 should always be combined with -noskip for mencoder, otherwise it will almost certainly cause A-V desync.
We reject: kings, presidents and voting.
We believe in: rough consensus and running code.
We believe in: rough consensus and running code.
Re: Subtitles with Ffmpeg
Never tested it but you can use MEncoder in a way as FFMPEG works, with special o= parameter so default MEncoder settings can be overridden by FFMPEG params?
http://bugzilla.mplayerhq.hu/show_bug.cgi?id=2046
Don't know if the hint in link can help but it is worth trying it. Maybe electing some ffmpeg params bundled in MEncoder will gave same result when ffmpeg alone is used? Who knows...
EDIT:
In past I used a custom PMS build which replaced -mc 0 -noskip with -mc 0.005 to fix A/V sync problems.
-mc 0 -noskip will disable built-in a/v sync algoritm totally and also will ignore audio delay set.
-mc 0.1 is sometimes too much so I used 0.005 which worked best for me.
Now MEncoder is not so buggy as in past so removing -mc 0 -noskip is in most cases enough to make a/v sync OK.
http://bugzilla.mplayerhq.hu/show_bug.cgi?id=2046
Don't know if the hint in link can help but it is worth trying it. Maybe electing some ffmpeg params bundled in MEncoder will gave same result when ffmpeg alone is used? Who knows...

EDIT:
In past I used a custom PMS build which replaced -mc 0 -noskip with -mc 0.005 to fix A/V sync problems.
-mc 0 -noskip will disable built-in a/v sync algoritm totally and also will ignore audio delay set.
-mc 0.1 is sometimes too much so I used 0.005 which worked best for me.
Now MEncoder is not so buggy as in past so removing -mc 0 -noskip is in most cases enough to make a/v sync OK.
Re: Subtitles with Ffmpeg
Yeah I share your frustration and we (and the FFmpeg and MEncoder developers) are constantly improving audio/video sync.
UMS knows how to implement the suggestion the others made, just go to the Transcoding Settings tab, then the MEncoder page, then untick "A/V sync alternative method" and Save.
That will make MEncoder use different methods to synchronise and it may work better for you.
One thing we have noticed is that the number of CPU threads affect the sync when using that setting, so you should set your CPU threads (on the Common Transcode Settings page) to the lowest value you can. 2 seems stable, and above 4 is where the sync problems get pronounced.
UMS knows how to implement the suggestion the others made, just go to the Transcoding Settings tab, then the MEncoder page, then untick "A/V sync alternative method" and Save.
That will make MEncoder use different methods to synchronise and it may work better for you.
One thing we have noticed is that the number of CPU threads affect the sync when using that setting, so you should set your CPU threads (on the Common Transcode Settings page) to the lowest value you can. 2 seems stable, and above 4 is where the sync problems get pronounced.