I used this script as a VDR hook to automatically convert my recordings to Xvid files which I could then play on my mobile phone.
It accomplishes the conversion with the following steps:
- Check if the recording is on a black-list. Usually you don't want to convert all of your recordings
- Demultiplex it using ProjectX. That ensures that your recording is undamaged and synced.
- Calculate the maximum video size while respecting the aspect ratio and a restriction to 307200 pixels (maximum on my then mobile phone LG KU990 Viewty).
- Re-encode to Xvid (optionally using a two-pass encoding).
- Remove temporary files.
To run this script for every new recording you can create a shell script which calls this Python script. The shell script itself has to be in the
recording-hooks directory of your VDR configuration (
/etc/vdr/recording-hooks/ on Debian):
#!/bin/bash # Use Latin1 as charset export LC_ALL=de_DE # Run vdr2xvid nicely in the background nice -n 19 /pfad/zu/vdr2xvid.py $1 $2 &
Happy video watching!