Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old February 9th, 2009   #1
Hakimio
Just Give Me the Beans!
 
Hakimio's Avatar
 
Join Date: Nov 2006
Location: Lithuania
Beans: 58
Ubuntu 8.10 Intrepid Ibex
Lightbulb [HOW TO] Video Converter for Chinavasion mp4 players

HOWTO: Video Converter for Chinavasion mp4 players

Intro
An acquaintance of mine needed a way to convert video for his Chinavasion Touch Screen MP4 Player (aka chinese ipod touch clone) so I wrote him a bash script for that. Most of the code is just copied from video-convertor script. Only some bugfixes & additions were made by me. Changes I made to the original script are described in the Changelog section.

Features:
  1. Batch conversion;
  2. Linux, Mac OS & BSD compatible (here I will only describe how to get it working with Ubuntu/Debian systems);
  3. Supports many Chinavasion MP4 player screens and support for more can be easilly added (contact me by posting in this thread or by sending private message if your Chinavasion mp4 player is not supported).
    Supported resolutions:
    • 320x240
    • 220x176
    • 160x128
    • 128x96
  4. Video quality and aspect ratio can be selected;
  5. settings are saved;
  6. Can be easily translated (current translations include: english & lithuanian);
  7. Appropriate video FPS are selected depending on selected resolution;

Installation
  1. Download one of the scripts attached to this post (english and lithuanian versions available)
  2. Place the script in the Nautilus scripts folder (/home/YourUserName/.gnome2/nautilus-scripts)
  3. Make sure the file is executable
    Code:
    chmod +x ~/.gnome2/nautilus-scripts/MP4-Player-Video
  4. Install mencoder:
    Code:
    sudo apt-get install mencoder
  5. Select some video files. Right-click, Choose Scripts->MP4-Player-Video.
    Here is a video showing script in action:
    mirror #1
    mirror #2
    mirror #3

Change log
Changes made to the original script:
  • Settings are saved
  • All selected files are checked - not only the first
  • Cancel works correctly when pressed during conversion (at least in ubuntu 8.10, see known issues for more info)
  • MPEG file is correctly identified now
  • Newlines work when echoed
  • The checking if the file is video file ends instantly when any match is found

Known issues
It is reported that zenity auto-kill switch doesn't work in ubuntu 7.10 & 8.04, so the encoding of the file that is being encoded when Cancel is pressed will not stop. However, the good news is that encoding of the next file will not start. Bug report.
If for some reason you are not willing to upgrade ubuntu, you can use dirty hack suggested by bodhi.zazen to deal with this issue. To do that replace the following line of code:
Code:
mencoder "$movie" -o "$file" -ofps $fps -vf-add scale=$scale -vf-add expand=$resolution:-1:-1:1 -srate 44100 -ovc xvid -xvidencopts bitrate=$bitrate:max_bframes=0:quant_type=h263 -oac lavc -lavcopts acodec=mp2:abitrate=$abitrate 2>&1 | awk -vRS='\r' '$1 ~ /Pos/ {gsub(/f/,"  ");gsub(/%)/," ");gsub(/ \(/," ");if ($4>0)print $4; fflush();}' | zenity --progress --title="Converting video file..." --text="$Video_Count file. Filename: $movie " --auto-close --auto-kill
with
Code:
mencoder "$movie" -o "$file" -ofps $fps -vf-add scale=$scale -vf-add expand=$resolution:-1:-1:1 -srate 44100 -ovc xvid -xvidencopts bitrate=$bitrate:max_bframes=0:quant_type=h263 -oac lavc -lavcopts acodec=mp2:abitrate=$abitrate 2>&1 | awk -vRS='\r' '$1 ~ /Pos/ {gsub(/f/,"  ");gsub(/%)/," ");gsub(/ \(/," ");if ($4>0)print $4; fflush();}' | zenity --progress --title="Converting video file..." --text="$Video_Count file. Filename: $movie " --auto-close &

RUNNING=0
while [ $RUNNING -eq 0 ]
do
sleep 1
if [ -z "$(pidof zenity)" ]
then
  pkill mencoder
  RUNNING=1
fi
done
To do
  • test & fix the bugs (if present)

About Touch Screen Chinavasion MP4 Player

I don't own the player myself, but anyway hare are few things you might want to know about it:
The Good
  • Really cheap, like 50$ for 8GB model without camera
  • Radio built-in
  • Doesn't require special software to copy files to the device (acts as ordinary flash drive)
  • Smaller than ipod touch (3.70x2.17x0.59 compared with 4.3x2.4x0.31)
  • miniSD slot (unlike ipod touch)
  • Built-in speaker
  • Optional camera
  • Up to 8GB memory
  • Radio
  • Picture viewer (JPEG)
  • Built in MIC
  • Pretty good screen
The Bad
  • No wi-fi
  • Touch screen is not really sensitive (should be ok when using stylus pencil though)
  • No firmware upgrades will be provided
  • Play/pause buttons are reversed
Video review by Citiclown
Attached Files
File Type: gz MP4-Player-Video.tar.gz (3.5 KB, 50 views)
File Type: gz MP4-Player-Video[lt].tar.gz (3.6 KB, 14 views)

Last edited by Hakimio; February 9th, 2009 at 06:05 PM.. Reason: translation fixes
Hakimio is offline   Reply With Quote
Old March 28th, 2009   #2
tippyaloishes
First Cup of Ubuntu
 
Join Date: Jan 2009
Beans: 6
Re: [HOW TO] Video Converter for Chinavasion mp4 players

I am not only new to ubuntu, I'm new to PCs all together. I have a chinavision mp4 player and I can't convert videos. The convert disc I was given with it doesn't work. I want to do what you put on here but I don't know what you're saying exactly. Can you please explain how I can find a script? Or a file? Or a script folder? Also what and how would I use the codes you put up, like where do they go? Also what is nautilus and how can I find it? I found something that said nautilus on my pc but it didn't say what it is. Please help if you can Thank you..
tippyaloishes is offline   Reply With Quote
Old March 29th, 2009   #3
Hakimio
Just Give Me the Beans!
 
Hakimio's Avatar
 
Join Date: Nov 2006
Location: Lithuania
Beans: 58
Ubuntu 8.10 Intrepid Ibex
Re: [HOW TO] Video Converter for Chinavasion mp4 players

Quote:
Originally Posted by tippyaloishes View Post
I am not only new to ubuntu, I'm new to PCs all together. I have a chinavision mp4 player and I can't convert videos. The convert disc I was given with it doesn't work. I want to do what you put on here but I don't know what you're saying exactly. Can you please explain how I can find a script? Or a file? Or a script folder? Also what and how would I use the codes you put up, like where do they go? Also what is nautilus and how can I find it? I found something that said nautilus on my pc but it didn't say what it is. Please help if you can Thank you..
The script you need is in the archive which is attached to my guide. Download the archive. Then:
  1. Open the terminal, which can be found in Applications -> Accessories -> Terminal
  2. Enter:
    Code:
    nautilus ~/.gnome2/nautilus-scripts
    to go to the folder, where all nautilus scripts are located.
  3. Extract the script from the archive you downloaded to the folder you just opened in the previous step.
  4. Close nautilus and execute in the terminal (If you renamed the script you downloaded, change MP4-Player-Video to the new file name):
    Code:
    chmod +x ~/.gnome2/nautilus-scripts/MP4-Player-Video
  5. Find a link to the video tutorial, I posted in the guide.
Hakimio is offline   Reply With Quote
Old March 29th, 2009   #4
tippyaloishes
First Cup of Ubuntu
 
Join Date: Jan 2009
Beans: 6
Smile Re: [HOW TO] Video Converter for Chinavasion mp4 players

Oh wow thank you.... I've been trying for weeks now. Thank you so much for the extra detail
tippyaloishes is offline   Reply With Quote

Bookmarks

Tags
chinavasion, converter, mp4 player, video, video converter

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:00 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry