Navigation

Home
About
Contact Us
Korean Word Quiz

News

13 Oct 2008 Mobile is Web 3.0

20 Aug 2008 Holiday In Rotarua

22 Feb 2008 South African Trip Video Part 2 - uShaka!

17 Feb 2008 South African Trip Video

10 Feb 2008 Crazy Korean Pizza

17 Jan 2008 An Afternoon down at Takapuna

17 Nov 2007 Gun shots and a Latte in the New South Africa

4 Nov 2007 The Flight From Hell

28 Oct 2007 Rockchip MP4 Player video encoding on Linux

4 Sep 2007 Fun with Sub Surface Scattering

Korean

28 Apr 2008 Korean Language 2 year retrospective

5 Jul 2007 Korean Links

20 May 2007 Korean study 1 year retrospective. (Part Two)

17 May 2007 김치 맨 (Kimchi Man!)

10 May 2007 Korean study 1 year retrospective. (Part One)

5 Nov 2006 Speak of the Tiger, and he will come

25 Oct 2006 When Peace is Commanded!

18 Oct 2006 More 까 (ka) than I care for.

7 Aug 2006 Bad Engrish T-Shirt

12 May 2006 Korean Notes Index Page

Side Projects

22 Mar 2006 Korean Font Support in Blender

19 Jan 2006 Fishy Fish. Eye Socket Modelling

11 Dec 2005 Halo How To

1 Dec 2005 20th Century Logo

15 Sep 2005 Rod Logo Scrolling Message

24 Aug 2005 LIFE.EXE Layout 3D


RSS News Feed.

Links

Scott, another Blender Head buddy.

Blender the great Free 3D program which I use.

BURP! excuse me. BURP is a free online distributed render system - Go sign up and donate CPU power.

Rockchip MP4 Player video encoding on Linux


Recently I purchased a Rockchip MP3 / MP4 player off our favourite online auction site. Its a pretty nifty player, and although it connected to Ubuntu without problems, creating video files was another issue.

Rockchip players are apparently a Chines MP4 player which over sell the video capabilities just a little. They can't play just any old MP4 video, it has to be encoded in a specific way. Trying to find the right combonation of video codec to audio codec nearly drove me up the wall. Eventually I used wine and installed the software which it comes with for windows and tried converting some vids.

The conversion worked and to my surprise, it used Mencoder (Mplayer) to convert the videos. So I looked that the process list and gleaned all the information I needed and here are the results for your transcoding pleasure...

First up, make sure mencoder is installed, so you might want to type the following from the command line...

sudo apt-get install mplayer mencoder

To convert a video which is in 4:3 Aspect ratio you can use the following..

mencoder -noodml INPUT_VID.avi -of avi -o OUTPUT_VID.avi -ofps 15 -vf-add scale=160:-2,expand=160:128 -srate 44100 -ovc xvid -xvidencopts bitrate=400:max_bframes=0:quant_type=h263 -oac lavc -lavcopts acodec=mp2:abitrate=96

If you have a video in 16:9 aspect ratio, you can use the following to produce a video with black bars at the top and bottom...

mencoder -noodml INPUT_VID.avi -of avi -o OUTPUT.avi -ofps 15 -vf-add scale=160:-2,expand=160:128 -srate 44100 -ovc xvid -xvidencopts bitrate=400:max_bframes=0:quant_type=h263 -oac lavc -lavcopts acodec=mp2:abitrate=96

If you have a video in 16:9 aspect ratio and you want a fullscreen version with the edges cropped of then this should do...

mencoder -noodml INPUT_VID.avi -of avi -o OUTPUT.avi -ofps 15 -vf-add scale=-2:128,crop=160:128:30:0 -srate 44100 -ovc xvid -xvidencopts bitrate=400:max_bframes=0:quant_type=h263 -oac lavc -lavcopts acodec=mp2:abitrate=96

Update. A viewer of this page asked me another question which relates to the Rockchip and other cheap USB devices. If your usb device works fine under windows but does strange things in Ubuntu, like disconnecting half way through a transfer, or connecting then immediately disconnecting, they you might just be interested in this solution...

Basically the problem lies in the fact that the USB chip on the device reports the max_sectors value too hight for it to handle. So when a transfer begins, the computer pushes too much info down the cable at a time, causing the chip to have issues.

The permanent fix involves having root access to the box you want it to work on and is fixed as follows

First up you need to find the vendor name of your device. you can do it by typing the following
udevinfo -a -p /sys/block/sdb | grep vendor
Here sdb is the divice name for my device, it might be different for you, so do an ls /sys/block/ to see what is there. Be careful to ensure you get the correct device the output of the command above should match the name of your device in some way. My output was as follows...

ATTRS{vendor}=="RockChip"
ATTRS{subsystem_vendor}=="0x1028"
ATTRS{vendor}=="0x8086"

The important bit of information here is "RockChip" Keep than handy.

Next, you need to edit the following file as root
gedit /etc/udev/rules.d/80-programs.rules

A the end of the file add the following line...
BUS=="scsi", SYSFS{vendor}=="RockChip", RUN+="/bin/sh -c '/bin/echo 64 > /sys/block/%k/device/max_sectors'"
Substitute your vendor name where it says "RockChip"

Now you should be able to disconnect the device and reconnect and everything should work fine. If it doesn't - sorry. You might want to google something like 'max_sectors but ubuntu udev'

I hope this solves your problems.



Comments

bo - 29 Oct 2007

Mplayer expert!!!
We use mencoder to transcode the videos on our site. very powerful indeed.

Scott - 22 Apr 2008

Hi there. This is exactly the info I needed. Thanks! I have a problem. I need the Windows software, which I accidentally deleted (stupidly thinking I didn't need it). Can you tell me where to find a copy?

Kevin K - 15 Jun 2008

These instructions work for the Zvue 250 player as well. Excellent!

Elton - 15 Jun 2008

Hi Kevin, great to hear there that.

One more bit of info which is relevant to the Rockchip. I noticed that after playing a video for 40min or so, the audio goes out of sync for some reason. I have no idea why this happens, but one solution is to split the video up into half hour chunks.

To do this you need to add the following options to your encoding command
-ss SEC where SEC is the seconds to start from and
-endpos SEC where sec is the endpoint in seconds.

So, to encode the first half hour of a movie add the following...
-ss 0 -endpos 1800

Note that this will only work for movies that have a correct time code. If you have movie files from Mythtv you can copy them without quality loss and restore the index as follows...
mencoder movie.avi -ovc copy -oac copy -o out_movie.avi -forceidx

I hope that helps.

Will - 21 Jun 2008

Thanks for this info. I bought my wife one of these players so she can watch movies when she goes in to hospital to have our baby.

I started trying to work out what settings to use with mencoder and gave up and searched google instead.

This is just what I needed. Cheers!

JMM - 2 Aug 2008

Hi,
The "64 max_sectors" trick also worked great for my neonumeric nm4 (default was 240 max_sectors).
Thanks

Pierre - 23 Aug 2008

Thanks... My video is very good but there is a problem with this audio. Sound is very bad. Do you have any ideal?

Source audio is MP3 at 48000 or 32000.

Javawocky - 23 Aug 2008

Hi Pierre,

I once had had a problem very bad audio. It turned out to be a certain version of Mencoder which was stuffing up. If possible, try a different machine and see if you get the same results. Otherwise try install a different version of Mplayer.

Hope that works!

Pierre - 24 Aug 2008

Thanks Javawocky!

I was running: MEncoder 2:1.0~rc1-0ubuntu1~gutsy1

I am now running: MEncoder 2:1.0~rc2-0ubuntu1~gutsy1

Sound is good now with this version.

Regards

Javawocky - 24 Aug 2008

Glad to be of service!

Amber - 2 Dec 2008

Hi, Guys. I have seen this rockchip mp4 player on ebay, and was just wondering if it is worth buying?

Q - 2 Dec 2008

MP4 player on ebay... it's okay still trying to understand how it works...

So... it's FM radio and think of it as an ipod shuffle with an touch screen.

It comes with tetris and it doesn't seem to allow you to add games. Only basic docs. No tech info. Chip maker isn't giving out info.

Q - 2 Dec 2008

One other comment. based on the above mencoder options I figured out the 8gb MP4 video encoding. It's

mencoder -noodml INPUT.avi -of avi -o OUTPUT.avi -ofps 22 -vf-add scale=320:-2,expand=320:240 -srate 44100 -ovc xvid -xvidencopts bitrate=400:max_bframes=0:quant_type=s16le -oac lavc -lavcopts acodec=mp2:abitrate=96

Q - 2 Dec 2008

Does anyone have info on the Rockchip ? Or the OS on these players?

Javaris - 4 Jan 2009

yo how did you get it too work usig wine in ubuntu whats your settings because when i try to convert my videos it stops converting at 9 secs thats how long my video lasts

Javawocky - 4 Jan 2009

Hi Javaris,

That is strange, do you have an endpos option set in your encoding string if so - remove it.

Also, I don't use wine, I use mencoder supplied by Ubuntu itself and it works fine.

lca77 - 11 Apr 2009

Getting Audio & Video staying in Sync is very easy: the videobitrate has to be a multiple factor of the audiobitrate: if Audiobitrate should be 96, video has to be 192 or 288 or 384 ;-) Tested wit a 60min videofile on an RK2606A- and RK2608A-Player. rgrds from Germany, lca77

Add your comments here
Name *

Email *
(Will not be published)
Your comment *
(No html please.)
Your Website (Optional)

(C) Elton Fry 2006