[mythtv-users] FFMPeg Commercial cutting puts audio out of sync

Mike Perkins mikep at randomtraveller.org.uk
Sat Sep 13 09:21:54 UTC 2014


On 13/09/14 04:04, Justin Alcorn wrote:
> Ubuntu 14.04.1 with the real ffmpeg loaded (same problem with the
> avconv version).
>
> I'm trying to take files created in MythTV with a HDPVR, cut the
> commercials and put the video into an MP4 container for use with
> MythRoku.
>
> the command
>
> `ffmpeg -i $file -acodec copy -vcodec copy -f mp4 file.mp4`
>
> Works fine. Once I update the database, I can watch the file in
> MythRoku or Plex.
>
> However, when I try to cut out the commercials, the audio gets out of
> sync by just over 1 second (audio delayed) whenever I cut past the 0
> mark.  Totem Video player and VLC both play the resulting video fine,
> but I can see a "hitch" at the beginning while they are syncing the
> audio, so I know the information on the audio sync is in the file
> somewhere.  Mythroku and Plex both are out of sync when playing the
> file.  The MythTV Frontend player actually does play it correctly, and
> I can hear the "hitch" as it syncs the audio.
>
> After hours of reading posts and playing with settings, I've cot a
> couple of theories.
>
> A) the video is cutting on 'key frames', not at exactly the time I say
> to cut, but the audio cuts at the exact mark
> B) The video being in variable bitrate throws off the cutting
>
> But I'm not sure how to solve either of these problems.
>
[snip]
>
The most obvious thing to say is that you should make sure your cuts are all on 
keyframes. This should reduce any difference between audio and video to the minimum.

If you don't make cuts on keyframes then the video processor has to try and 
bridge data that really belongs to two different scenes and adjust dynamically, 
which can look terrible on-screen. Keyframes is the way to go.

-- 

Mike Perkins



More information about the mythtv-users mailing list