Other languages : fr
Boxes like the freebox provided by the french ISP "free" allow recording of TV channels. Such records are encoded using an internal vlc service in Transport Stream format. Usually for a common 2h movie the size of the records can reach 3 to 4Gb -- and if you intend to record at least 2 movies each week then you will reach your hard disk capacity sooner than expected!
ts2avi is a python script that will allow conversion of all your ts videos into a common divx container (with MPEG4 for video format and MP3 for audio format). The sizes of the produced video files are 4 to 6 times lesser than the original ones -- with however a minimum degradation of image quality.
ts2avi being a python script, of course you will need a recent installation of python. It is recommended to have a 2.7 version although the script might work with a 2.6 version, as it uses the subprocess module.
For video conversion the script relies on mencoder, please check that it is installed or download it from http://www.mplayerhq.hu/design7/dload.html. For most GNU/Linux distributions it should be available alongside with mplayer.
ts2avi is at present working only for linux-based platforms. However it can be easily tuned for MS Windows ones, if the prerequisites are installed, but it should need a small tuning of the script to overwrite the default path for mencoder.
The ts2avi script is shipped as a distutils package. To install the library, unpack the distribution archive, and issue the following command:
$ python setup.py install
If you want to have a local installation of the script, or equivalently if you don't have root access for installing site-packages, you may want to make benefit from the new 'user' option which is provided by recent versions of distutils:
$ python setup.py install --user
This will install everything in your $HOME/.local directory for POSIX users. Don't forget to add your $HOME/.local/bin to your path for instance in you .bashrc source bash configuration file.
You might also install ts2avi as an egg package using the setuptools easy_install script:
$ easy_install ts2avi
would do everything for you: download and install ts2avi.
Basic usage is as follows:
$ ts2avi.py <myrecord>.ts
This would convert the argument TS file into an MPEG4 <myrecord>.avi file in the same current directory. Please notice that the script recognizes all current Unix pattern expansion, so for instance if you would like to convert all records from a given TV channel:
$ ts2avi.py TMC*.ts
For storage of output files in a different directory, which could be usefull if you intend to copy the avi files on an external hard disk for instance, use the --output_dir option:
$ ts2avi.py --output_dir=/media/hdd/Videos *.ts
Video conversion is done using different profiles (see How it works). To select a given profile issue the following command:
$ ts2avi.py --profile='fast' <myrecord>.ts
For full explanation on the different options of ts2avi, try:
$ ts2avi.py --help
For each argument file, the video conversion is performed in a temporary directory. The different steps are the followings:
Different profiles are available however. To select one of them, use the --profile option. The previous steps refer to the default profile which is supposed to provide the best quality possible.