Showing posts with label ffmpeg. Show all posts
Showing posts with label ffmpeg. Show all posts

Monday, July 11, 2011

Convert videos to iPad 2 format

Recorded programs on my MythTV are in a lossless HD mpg format, which doesn't play well on my iPad2 using AirVideo Server over wlan (via wine). So, instead of having AirVideo Server converting it through the wine abstraction layer (which requires more CPU/memory, and uses ffmpeg.exe anyway), I just run this user job from my MythTV server to convert the files that I care to watch on my iPad.

Step 1:
Create this file which I call /usr/bin/mythconverttoipad. If you have an issue with "too may threads," remove -threads 16. I am using this script on a 3 core machine, the -threads option speeds things up a bit.

#!/bin/bash
DIR=$1
FILE=$2

echo $DIR
echo $FILE

ffmpeg -y -i $DIR/$FILE -ab 320kb -vcodec libx264 -b 3200kb -s 1280x720 -threads 16 $DIR/$FILE.m4v


Step 2:
Make the script executable.

chmod +x /usr/bin/mythconverttoipad

Step 3:
Add script as user job within MythTV.

Within mythtv-setup add the following user job:

/usr/bin/mythconverttoipad %DIR% %FILE%

Step 4:

Enable it within rules.

Within a program recording rule (within mythfrontent), enable this user job to be run post-recording.

Step 5:
Access the files from Air Video client or other player.

If you have questions, please comment.