Past EED rants

Labels

Live leaderboard

Poker leaderboard

Voice of EED

Friday 21 May 2010

Re-containering And Transcoding video for android

If you’re a fan of downloading video from iPlayer unencumbered by nasty DRM this may be useful.

The high(ish) res files for iPhone can be downloaded by iPlayer Downloader or get_iplayer. But they are in a MOV container & unplayable on android devices. I’m yet to get my desire, but that didn’t stop me wanting a fix now :)

MP4Box will do the job, and here’s a batch file that will do the right stuff. It’ll work with multiple files passed on the command line too, so you should be good to add it to your SendTo menu.

@echo off
:start
if %1f==f goto end
echo %1
for /f "delims=." %%a in (%1) do (
echo %%a
echo Extracting video to "%%a.h264" ...
"C:\Program Files\mp4box\MP4Box.exe" -raw 1 "%%a.mp4" -out "%%a.h264"
echo.
echo.
echo.
echo Extracting audio to "%%a.aac" ...
"C:\Program Files\mp4box\MP4Box.exe" -raw 2 "%%a.mp4" -out "%%a.aac"
echo.
echo.
echo.
echo Muxing "%%a.android.mp4" ...
"C:\Program Files\mp4box\MP4Box.exe" -fps 25 -add "%%a.h264" -add "%%a.aac" -new "%%a.android.mp4"
del "%%a.h264"
del "%%a.aac"
)
shift
goto start
:end

Update:

And should you need to transcode rather than re-container, our old friend Handbrake to the rescue. I've used these settings & had really good quality

@echo off
:start
if %1f==f goto end
echo %1

for /f "delims=." %%a in (%1) do (
echo %%a

"C:\Program Files\HandBrake\HandBrakeCLI.exe" -i %1 -t 1 -o "%%a.mp4" -f mp4 -I -X 480 -e x264 -b 1000 -a 1 -E faac -6 dpl2 -R 48 -B 160 -D 0.0 -x level=30:bframes=0:cabac=0:ref=2:vbv-maxrate=768:vbv-bufsize=2000:me=umh:8x8dct=0:trellis=0:weightb=0:mixed-refs=0 -v 1

)

shift
goto start
:end