So, what are our constraints? The Android computer is not powerful enough to play videos without hardware assist, and that hardware assist is only available when viewing H.264 videos encoded with the baseline profile. It doesn't work on main profile H.264 videos. Also, the Micro-SD card that I plug into the tablet must be formatted as VFAT, it isn't recognized when I reformat it to any more modern Linux filesystems, so our files are going to have to be under 2GB in size. Also, the Android screen is only 1280x800, so there's no point copying a 2560x1080 file there, the machine will have to reduce the resolution, we might as well do it before we copy it to the card.
So, a 1 hour show, recorded on the MythTV box, is about 8 GB and in the wrong format. We convert it in two steps. First, cut out any commercials and transcode it at high quality. For network broadcast television that chops off about 25% of the file size, and you probably didn't want to watch the commercials while sitting on the train/airplane anyway.
Next, it has to be transcoded to H.264 Basline. This can be done with ffmpeg:
ffmpeg -i PROGRAM.mpg -vcodec libx264 -vpre fast \
-vpre baseline -s hd720 -qmax 30 -acodec libfaac \
-ab 128k -ac 2 -threads 4 -ar 44100 -deinterlace \
PROGRAM.mp4
This takes the HDTV .mpg file from mythtv, "PROGRAM.mpg", and converts it. We use the libx264 video codec, fast settings, baseline profile, formatted for a high definition 720 line screen. "qmax" sets a limit on quality loss, I usually use a value between 25 and 30. We use the FAAC audio codec at 128kbits/sec, deinterlace the result, and write it to "PROGRAM.mp4".
The resulting file, about 45 minutes of air time, is about 600 MB in size.
No comments:
Post a Comment