Forums » Tutorial and setups »
What's your Workflow?
Added by Prof Yaffle almost 11 years ago
I've been around the houses on this for some time, so I thought I'd see if anyone else has a foolproof method of processing their files.
I used to use .mkv as the target tvheadend recording format, because mkvmerge could chop those up nicely. But I dropped that last year in favour of .ts due to audio problems (e.g. where audio switched from a stereo continuity announcement to 5.1 during the main programme).
Unfortunately, .ts files won't chop neatly in mkvmerge because of errors, so I tried ProjectX and a couple of other things before landing on re-encoding completely in Handbrake. It marginally shrinks the files (HD H.264) but produces something that mkvmerge can slice up (I've never got on with HB's encode from... to... settings to trim while encoding).
Downside 1: It takes f-o-r-e-v-e-r. Even on a quad-core i5, I'm spending up to 8 hours to re-encode a film. Utter nonsense.
Downside 2: HB uses x264, which defaults to a GOP of 250ish. That means 5-second accuracy on a 50Hz file, and that makes for ugly cutting. Yes, I can increase the I-frame frequency (e.g. keyint=25:min-keyint=13 to give half-second accuracy) but (a) the files now obviously get bigger and (b) the encoding takes even longer.
So, I've lurched back to avidemux (having stumbled on the way through ffmpeg, mencoder, mplayer...). Avidemux always used to have issues with MPEG-4 so I abandoned it when I moved off MPEG-2 - but a clean compile of 2.6.7 today seems to work well.
So I can:
1. Record on tvheadend
2. Load into avidemux
3. Trim pre- and post-amble (commercials in the middle TBD)
4. Copy the salient streams (e.g. dropping AD audio) and remux into .mkv or .ts
5. Leave the bloody thing alone and stop wasting my life fiddling with video files
I can't see any pros and cons of .ts versus .mkv here, so I'll stick with .mkv as the seeking is probably better supported. I initially tried .avi (avidemux's default) but that was a disaster in VLC and Parole - I don't think H.264 and .avi play nicely together.
Thoughts or comments? Any blow-you-away suggestions or improvements?
(Yes, I've tried comskip - Windows and Linux - but it struggles to identify most ad breaks and I end up tuning/doing the cut list by hand; yes, I genuinely do like to cut out the fluff and have a programme that starts where it should, end where it should, and doesn't need skipping around in the middle. Take those as for read :-) )
Replies (5)
RE: What's your Worklow? - Added by Prof Yaffle almost 11 years ago
Well, it almost works...
If the stream is error-less, then it works perfectly. The only drawback is that there's seemingly no way to keep the DVB subtitles, which isn't really an issue for me.
However, if there is an error, then avidemux borks with a "too short" complaint; most likely cause is "missing or incorrect timestamps (pts/dts)". ProjectX isn't fixing the error for me just yet, so maybe I'll need to run some files through Handbrake anyway just to bludgeon the errors into submission (assuming this one isn't corrupt beyond repair). A small price to pay if it saves me 8 hours on most/some/any files, though...!
RE: What's your Workflow? - Added by Prof Yaffle almost 11 years ago
Okay, using this as a diary/scratchpad - you never know, it may be helpful for someone else! - here are my conclusions so far:
1. If the stream is error-free, avidemux will chop it neatly. Keyframes are every second or so on my .ts streams.
2. If the stream has errors, avidemux will fail ("video too short" - most likely pts/dts errors).
3. avidemux works better with .mkv and .ts output containers than .mp4 - these sometimes have weird lengths and/or you can't seek properly through them.
In terms of fixing the file:
1. TSmuxer introduces sync problems.
2. ProjectX doesn't work with H.264 video streams.
3. Recoding it in Handbrake fixes the streams but takes ages
4. Simply remuxing into mkv with mkvmerge also seems to fix the timing, and doesn't introduce any sync errors
So:
1. If it's error-free: avidemux, trim and output to mkv, job done.
2. If it has errors: remux into mkv with mkvmergegui, then into avidemux to trim and back out to mkv
I'm half inclined to remux everything into mkv as a post-processing script to save a bit of time, since avidemux should then always accept the output.
I'd still rely on Handbrake rather than avidemux's x264 video filter if I need to process the stream further - e.g. cropping an overhanging DOG off the top of the image - but that's by the by.
RE: What's your Workflow? - Added by Prof Yaffle almost 11 years ago
Or, of course,
2. If it has errors, use avidemux to find the appropriate cut points and then just use a simple EDL file, leaving the original untouched.
This is probably the best, as it's really hard to fix timing issues if the data is corrupt or not there. While remuxing does a decent job, I've noticed some stuttering of the video as it keeps synched, which isn't apparent in the TS file. I'm assuming that the error correction is sufficient to bludgeon its way through errors on the original.
RE: What's your Workflow? - Added by Adam Sutton almost 11 years ago
Prof,
I haven't read your full thread. But I used to just use avconv (with a wrapper script) to manually cut (top and tail only, most stuff I record is on channels without commercials during the feature) and remux to MKV (manually as in I would determine the cut points in VLC etc...). The only change I've made recently is to switch to TS due to some recent problems with BBC services.
I've only recorded a handful of things with ads inline and thus far haven't even bothered to cut them. But my plan is probably just to cut the individual chunks and then use the XBMC naming convention (-partX) to have XBMC auto stitch them together on playback rather than worry about properly re-stitching the files. Although I think if you concat .ts files, ffmpeg just about copes (sometimes).
I no longer bother with any transcoding. The only thing I used to transcode (and probably still would) is DVD to H264, but then I very rarely buy DVDs these days. If I do buy stuff I prefer to get blu-rays.
Adam
RE: What's your Workflow? - Added by Prof Yaffle almost 11 years ago
Thanks, Adam. Yes, most of my stuff is advert-free as well - so I'm really just clipping off the recording pre- and post-amble for neatness and family-friendliness. There's the odd commercial-riddled C4HD film or stuff for the kids that needs more attention, but not much.
I'm landing on the EDL as the simplest way of "trimming" ts files, and leave it at that. Life's too short, after all, and XBMC has better EDL support than the original mplayer et al (e.g. HH:MM:SS.sss as reported in avidemux instead of 3600*HH+60*MM+SS calculations). I've also spent far too long with VLC trying to seek cut points, only to find them half a second out. And don't get me started on comskip.
I may choose to transcode to trim off the channel DOG on letterbox films. Otherwise, the only re-encoding I've had to do is where tvheadend recorded a seemingly-duff primary audio track; Handbrake repaired that even if VLC and XBMC struggled with the original.