Project

General

Profile

.ts file conversion recommendation

Added by Edward Crosby over 7 years ago

Hello.
I wanted to find out if anyone has any tips or recommendations of converting the recorded .ts file to .mp4, preferably via command line.
The plan I would like to use is, with TVHeadend running on my Ubuntu machine, once the recording has been completed setup a schedule via crontab to complete a conversion of the .ts file via command line while keeping the same quality but deinterlace. That way once it is converted to an .mp4 file I can just move it to where my Kodi box can see it and play it.


Replies (5)

RE: .ts file conversion recommendation - Added by K Shea over 7 years ago

You could use ffmpeg, but generally speaking there is no reason to. Unless a channel is doing something really funky, Kodi can play a recorded .ts file with no problem whatsoever. And even if you do decide to conver for some reason, you'd want to use a post-recording script - see https://tvheadend.org/projects/tvheadend/wiki/Tvheadend_post_recording_scripts

For an example of using ffmpeg to do a conversion see https://freetoairamerica.wordpress.com/2015/01/07/how-to-play-video-recorded-from-high-bitrate-422-sources-on-low-power-systems/

RE: .ts file conversion recommendation - Added by Edward Crosby over 7 years ago

K Shea wrote:

You could use ffmpeg, but generally speaking there is no reason to. Unless a channel is doing something really funky, Kodi can play a recorded .ts file with no problem whatsoever. And even if you do decide to conver for some reason, you'd want to use a post-recording script - see https://tvheadend.org/projects/tvheadend/wiki/Tvheadend_post_recording_scripts

For an example of using ffmpeg to do a conversion see https://freetoairamerica.wordpress.com/2015/01/07/how-to-play-video-recorded-from-high-bitrate-422-sources-on-low-power-systems/

Thanks for that.
I would need to do some deinterlacing (I think that is the term, getting rid of the interlace lines a recorded TV show makes) after the recording too.

RE: .ts file conversion recommendation - Added by ullix tv over 7 years ago

I also keep just the .ts files for all recordings, which I will play "soon" and then delete, and Kodi plays that just fine. For anything I want to store for longer periods, and therefore look for a smaller file, I use this ffmpeg command in a Python script, started manually:

# HandbrakeCLI options:
# -O, --optimize          Optimize mp4 files for HTTP streaming ("fast start")
# --preset "Normal" 
# + Normal:  -e x264  -q 20.0 -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 
# --audio-fallback ffac3 -f mp4 --loose-anamorphic --modulus 2 -m --x264-preset veryfast --h264-profile main --h264-level 4.0
#command = 
'/usr/bin/HandBrakeCLI --preset "Normal" -O -i "' + fname + '.ts' + '" -o "path/' + fname + '.mkv" </dev/null  1> path/handbrake.log 2> path/handbrakeERR.log'

fname is the filename of the video without extension

Not sure how it deals with de-interlacing, but I think this is taken care off in Kodi anyway? At least, it works fine with me from DVB-S(2) recordings.

RE: .ts file conversion recommendation - Added by K Shea over 7 years ago

The thing about some programs like that, although I don't know about Handbrake specifically, is they are just a wrapper for ffmpeg. They save you from having to figure out some of ffmpeg's more arcane options, but often they run much more slowly than ffmpeg directly. Again, I don't know for sure about Handbrake, it is a very popular program so maybe it does have its own codecs, but still I suspect it takes longer than ffmpeg to do a similar conversion.

The other thing I don't like about some such programs is that they often re-encode the audio even when it isn't necessary, and lose the 5.1 surround sound in the process. With ffmpeg at least, if you tell it to to a straight copy of the audio track, it will do so without losing the 5.1. Again, I don't know how Handbrake works specifically, so that may or may not be an issue. Just something to check if you are so inclined.

RE: .ts file conversion recommendation - Added by Edward Crosby over 7 years ago

It looks as if Kodi views the .ts file just fine. I guess I will leave it as is.
Unfortunately, I will still have the commercials in the file, that's the only downside.

    (1-5/5)