Support and General Use > Plugins/Viewers

a shell script using mencoder to produce mpegplayer compatible videos.

(1/1)

wehn:
I just spent some time bashing together and testing a shell script using mencoder (from mplayer) to make rockbox mpegplayer compatible videos.

The script was optimised for semi-decent playback on the H300. It uses two pass encoding (which does make a noticeble difference with such a low bitrate) and i'm afraid I put priority on playback rather than encoding speed. It is slow. Maybe consider removing vhq from both sections to speed it up.

Thought I might share it here. I tried to add it to the wiki but I don't have access.


--- Code: ---#!/bin/sh
script=`basename "$0"`

TWOPASSFILE=divx2pass.$$.`date +%Y%m%d%H%M%S`


VIDEO_WIDTH=220
# set rockbox target's screen width

track="$1"
brate="100"
name="$2"

if [ "$track" = "" ] || [ "$brate" = "" ] || [ "$name" = "" ]; then
    echo "$script: Transcode a video to MPEG2 for Rockbox Mpegplayer"
    echo "$script <source-video> <output-filename.mpg>"
    echo "bitrate and output resolution can be set by editing $script"
    exit 1
fi

if [ -f "$name" ]; then
    echo "$script: [$name] exists, overwriting in 3 seconds ..."
    sleep 3
    rm -f "$name"
fi



mencoder $1 -passlogfile $TWOPASSFILE\
                 -of mpeg \
                 -oac lavc -lavcopts acodec=mp2:abitrate=96 \
                 -af resample=44100:0:0,volnorm \
                 -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=$brate:vmax_b_frames=16:vb_strategy=2:vhq:vpass=1 \
                 -vf pp=fd,scale -zoom -xy $VIDEO_WIDTH \
                 -ofps 25 \
                 -o /dev/null \

mencoder $1 -passlogfile $TWOPASSFILE\
                 -of mpeg \
                 -oac lavc -lavcopts acodec=mp2:abitrate=96 \
                 -af resample=44100:0:0,volnorm \
                 -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=$brate:vmax_b_frames=16:vb_strategy=2:vhq:vpass=2 \
                 -vf pp=fd,scale -zoom -xy $VIDEO_WIDTH \
                 -ofps 25 \
                 -o "$name" \


if [ -f "$TWOPASSFILE" ]; then
    rm $TWOPASSFILE
fi
echo "Ripped track [$track] to [$name]"
--- End code ---

AlexP:
Please add it to the wiki, it is easy to get access - sign up then ask in IRC, or post your wiki name here.  It'll just get lost on the forums.

GodEater:
Yes, please do as AlexP asks. This is exactly the sort of cool stuff we love to see get added to the Wiki!

Navigation

[0] Message Index

Go to full version