[mythtv-users] Current state-of-the-art for h264 cutlist processing?

John Pilkington J.Pilk at tesco.net
Thu Feb 8 10:16:54 UTC 2018


On 02/02/18 18:42, John Pilkington wrote:
> On 02/02/18 15:56, David King wrote:
>> On 02/01/2018 08:10 AM, John Pilkington wrote:
>>> Hi:  I rarely record DVB-T2 HD h264 recordings in which I want to make
>>> internal cuts, but it would be good to be able to do make them in a
>>> way that doesn't introduce glitches in playback.
>>>
>>> I find that Mythfrontend does a good job in playing uncut recordings
>>> with cutlists, but uPnP then plays all the ads and skipping is painful.
>>>
>>> My MythDVBcut script chops at videokeyframes; there may be glitches at
>>> cuts but there's no long-term loss of quality or a/v sync.  I've found
>>> other scripts that work similarly and are more elegantly coded.
>>> Frontend and uPnP glitches may differ in style and severity.
>>> I've tried going via mkvmerge but at present see a/v sync drift and
>>> haven't found an mkv/audio format that my tv plays acceptably via uPnP
>>>
>>> So, before I waste yet more time, has anyone found (or developed) a
>>> toolchain that is available and does this job properly?
>>
>> I don't know if what I have is an exact match for what you are trying to
>> do.  All my recordings come from cable for one thing, not DVB.  But,
>> anyway, through experimentation I've developed a workflow that produces
>> cleanly cut videos from MythTV recordings and cutlists.  The key missing
>> link for me was discovering the "--cleancut" option on the mythtranscode
>> command.  This lets cuts made on non-keyframes survive the transcoding
>> process.
>>
>> My workflow is:
>>
>> Edit the recording in MythTV, fine tuning the cutlist,
>> Start mythtranscode feeding the recording into audio and video fifos
>> with --honorcutlist and --cleancut options,
>> Start ffmpeg simultaneously, reading from the fifos and outputing a
>> lossless h264 MKV,
>> Use Handbrake to transcode the lossless MKV down into standard mp4 
>> format.
>>
>> I have a Python script that does this plus more.  It's got stuff in it
>> that's specific to my needs and it isn't generalized for use by others.
>> But it might provide you with some hints on command options to try.  I
>> run it standalone on my desktop PC where I only have mythfrontend
>> installed.  It talks to the backend over the network and uses NFS to
>> store the resulting video file on the backend.
>> https://pastebin.com/P5P21zJ9
>>
> Thank you for posting this.  I should have said above that I have found 
> cutting at keyframes quite acceptable with almost all my SD recordings 
> from digital sources, but I think this must depend on the way the 
> content is edited at source - and I'm usually just trying to remove 
> commercials rather than striving for a subtle artistic effect.  But I 
> will certainly examine your code with interest.  It may take some time.
> 

I played with your script yesterday:  interesting, and I learned some 
new wrinkles.  I knew of the fifo-based technique but hadn't realised 
that it decodes and re-encodes the entire file, so it will be quite 
slow, and I may set it aside for now.

I had a unicode-related problem when I tried it on a second box, and 
google gave me lots of python-speak.  It read the titles after I had 
looked at (for example) mytharchive's mythburn.py and copied in the 
first 3 lines.

 > Thanks again.
 >
 > John


More information about the mythtv-users mailing list