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. |