[mythtv-users] Lossless-cut Not Ubuntu

Doug Vaughan r.d.vaughan at rogers.com
Fri Nov 2 12:23:01 UTC 2012


On 12-11-01 11:00 PM, Jason But wrote:
> As an aside, I'm currently using mythnuv2mkv 
> (http://www.mythtv.org/wiki/Mythnuv2mkv) to do my cutting. With 
> regards to lossless_cut, I see mention that cuts "should" be made on 
> key-frames, what happens if they are not?
>
> I have made a number of recordings which I've cut and compressed, 
> selecting good frames to end/start cuts on is difficult and you often 
> get artifacts of commercials in the final cut. Alternatively, 
> sometimes the nearest key-frame means that audio and images are cut 
> from the final copy.
>
> I suppose what I am trying to say is that it would be nice to be able 
> to do frame-accurate cutting (or at least near). If we are re-encoding 
> to h264 anyway, is there any reason you aren't decoding all frames and 
> re-encoding them?
Jason,
     Maybe I can rephrase the comment "should", no matter if you chose 
keyframes in the MythTV UI or just let commflag decide your cut points, 
the utility that does the cutting "mkvmerge" picks the nearest keyframe 
based ontheinput time stamp value.

Those time stamps are calculated "Frame number * Frames-per-sec = 
HH:MM:SS.nnnnnnnnn" time code(the decimals are nanosecond accurate).So 
if you had concerns about loosing some video and/or audio because you 
are forced to use a keyframe the point is moot.

No matter what, a keyframe will always be used so it is better that YOU 
choose which keyframe. You are right that sometimes choosing a keyframe 
does chop off video. I use a HDPVR and found that with a 720p59.940 FPS 
recording that the keyframes are approximately 2.48 seconds apart which 
definitely means I experience some unwanted chop now and again. This is 
an issue no matter which tool I used (ffmpeg, mkvmerge or Avidemux).

     In the end I do not want to see video artefacts at cut points so 
chose the tools which deliver that and accept the downside. My 
understanding is that with other video encoding types the amount of 
video time that passes between keyframes varies and are usually shorter.

With the Lossless Cut script, even if you have not actively set your cut 
points on keyframes it adjusts what it is given to the nearest cut 
pointsautomatically. This is done so that the cut segments better 
reflect the cut points input from MythTV.

- The start cut frames are adjusted to the nearest keyframe less than or 
equal to the start skip or cut frame number
- The end cut frames are adjusted to the nearest keyframe greater than 
or equal to the end skip or cut frame number

As for the comment "If we are re-encoding to h264 anyway", well in my 
case I already have h264 recordings. The point of Lossless Cut was to 
provide a consistent, MythTV integrated, method of producing lossless 
cut video files from as many different recording encoding types as 
possible. What you do after you have a lossless cut video, such as 
re-transcoding to different encoding types, it up to you.

When I started the project the MythTV developers commented that I should 
concentrate on lossless cuts for h264 recordings as the current 
solutions were wanting. That is what I did but I found out that mkvmerge 
handlesa wider range of video, audio and subtitle types than just h264. 
So the script was generic by virtue of the tools used.

Previously I was using Avidemux to manually cut commercials and it took 
about 5-7 minutes per 60 minute TV show. Now with a commflagged video 
and using Mythtv UI to manually verify and adjust the cut points (if 
required)it takes 2 minutes tops. For me this has been a worthy effort.

Thanks

Doug


More information about the mythtv-users mailing list