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

Justin Alcorn justin at jalcorn.net
Sat Sep 13 19:59:10 UTC 2014


On Sat, Sep 13, 2014 at 3:05 PM, John Finlay <finlay at moeraki.com> wrote:
> ffmpeg will only cut at a keyframe (AFAIK) and will skip to the closest
> keyframe following the position you specify. Therefore to use the
> mythfronteend editor to specify cutpoints you'll have to specify keyframes
> as the cutpoints around commercials. Unfortunately, the keyframes may not
> line up with the start and end of commercials - this is what I experience
> with ATSC MPEG2 streams.
>
> An additional problem with the mythfrontend editor is that it uses 1-based
> counting of frames and ffmpeg uses 0-based so if you take the mythfrontend
> cutlist of keyframes and use it in ffmpeg you will find that ffmpeg will cut
> at the following keyframe the one specified. The workaround is to subtract 1
> from every cutlist frame number.
>
> I hacked together a python script as a lossless transcoding Job to use
> ffmpeg (mythffmpeg) to cut out commercials using the mythfrontend cutlist.
> It works for MPEG2 but I don't know about H264 but in theory it should work.
> Look at the ffmpeg segment muxer
> (https://www.ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment)
> for documentation.

OK, that info helps.  One problem is that the script I found
translates the Myth cutlist to seconds and uses that to specify the
cuts.  I guess I better switch to using frames. I assume there's some
way to do that in ffmpeg?

The biggest unanswered question - HOW do I always specify keyframes as
cutpoints?  I don't know how to find keyframes.

Sorry, but I'm still pretty new at video.

--
Justin B. Alcorn
PGP Fingerprint A36D D691 C5B0 BE15 5A2A AF49 AA1C 372C


More information about the mythtv-users mailing list