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

Mark Perkins perkins1724 at hotmail.com
Sat Sep 13 21:36:34 UTC 2014



> On 14 Sep 2014, at 5:29 am, "Justin Alcorn" <justin at jalcorn.net> wrote:
> 
>> 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.
> 

When using the cutlist editor you can use up/down arrows to change the jump by amount. When I get to where I want the cut I just change to jump by keyframes then move left / right to pick the keyframe I want or suits the best.

> Sorry, but I'm still pretty new at video.
> 
> --
> Justin B. Alcorn
> PGP Fingerprint A36D D691 C5B0 BE15 5A2A AF49 AA1C 372C
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org


More information about the mythtv-users mailing list