Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  a shell script using mencoder to produce mpegplayer compatible videos.
« previous next »
  • Print
Pages: [1]

Author Topic: a shell script using mencoder to produce mpegplayer compatible videos.  (Read 1749 times)

Offline wehn

  • Member
  • *
  • Posts: 10
a shell script using mencoder to produce mpegplayer compatible videos.
« on: December 04, 2009, 08:38:28 AM »
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: [Select]
#!/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]"
Logged

Offline AlexP

  • Global Moderator
  • Member
  • *
  • Posts: 3688
  • ex-BigBambi
Re: a shell script using mencoder to produce mpegplayer compatible videos.
« Reply #1 on: December 04, 2009, 11:43:23 AM »
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.
Logged
H140, F60, S120, e260, c240, Clip, Fuze v2, Connect, MP170, Meizu M3, Nano 1G, Android

Offline GodEater

  • Member
  • *
  • Posts: 2829
Re: a shell script using mencoder to produce mpegplayer compatible videos.
« Reply #2 on: December 07, 2009, 02:36:58 AM »
Yes, please do as AlexP asks. This is exactly the sort of cool stuff we love to see get added to the Wiki!
Logged

Read The Manual Please

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  a shell script using mencoder to produce mpegplayer compatible videos.
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.073 seconds with 15 queries.