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
|-+  Rockbox General
| |-+  Rockbox General Discussion
| | |-+  Can't get the command right to encode video; need help! [SOLVED]
« previous next »
  • Print
Pages: [1]

Author Topic: Can't get the command right to encode video; need help! [SOLVED]  (Read 2910 times)

Offline Strife89

  • Member
  • *
  • Posts: 354
  • Michael Carr
    • Strife89's blog
Can't get the command right to encode video; need help! [SOLVED]
« on: January 25, 2008, 08:18:12 PM »
I am trying to use Mencoder to convert a few videos for use on my Sansa c200.
(I have already tested video playback on the Sansa with the iAudio X5 video. It works well!)
However, no matter how I tweak the command line (most notably by using the "-oac copy" command, since the lack of an mp3lame encoder has foiled other encoding programs), I cannot get the encoder to work properly.
I am using Ubuntu 7.10, and calling up the terminal takes me to "/home/michael"
My videos are all under "/home/michael/Videos". Some are .avi (and, on Windows, require the DivX codec package to play; they were made with Pocket DivX Encoder to make the originals playable on my Palm), and some are .mpg (not sure which one, either MPEG2 or MPEG4).

So, can anyone offer a command that I can paste the file names into, then paste it all into the terminal, and get it to work? :-[ I've tried everything I know....

Quote
Sansa c200:  screen size: 132x80;   4:3 resolution: 106x80   16:9 resolution: 132x74

TERMINAL EXAMPLE:
mencoder -of mpeg -oac lavc -lavcopts acodec=mp2:abitrate=96:vmax_b_frames=16:vb_strategy=2 -af resample=44100:0:0 -ovc lavc -lavcopts
vcodec=mpeg2video:vbitrate= -vf scale=:,harddup -ofps 25 -o .mpg

VIDEO OPTIONS:
-ovc lavc  [output video module]
-lavcoptc vcodec=mpeg2video [output video codec]
...vmax_b_frames=16:vb_strategy=2 [the player needs as many b-frames as possible, to ease decoding and frame skipping]
(note: specify the video bitrate with: mpeg2video:vbitrate=)
-vf scale,harddup [scale the video, remove duplicate frames]
-ofps [output frames per second, depending on the target, adjust as needed]
-zoom [when scaling, zoom rather than crop]

AUDIO OPTIONS: (remember, I'm trying to just copy the audio; no reencoding at all)
-oac lavc [output audio module]
-lavcopts acodec=mp3:abitrate=192 [output audio codec and bitrate, mp1/mp2/mp3 can be used]
(note: if your video already has a compatible audio track simply use '-oac copy' to copy it to the output file without transcoding)
-af resample=44100:0:0 [resample to 44.1 kHz, otherwise it won't play at proper speed]
« Last Edit: January 26, 2008, 02:16:05 PM by Strife89 »
Logged
Rockbox: Sansa Clip Zip, iPod Color, iRiver H320

Android: Moto X4, Galaxy Tab S2 T710

Offline cpchan

  • Member
  • *
  • Posts: 198
Re: Can't get the command right to encode video; need help!
« Reply #1 on: January 25, 2008, 09:38:00 PM »
What is the problem when you use -oac copy (if the audio is compatible with your device)? Please provide a commandline example when you are copying. Also, no one can help you if you don't post the errors you are getting. FWIW, here is a script that I personally use for my e280. You will need to change the values of a few variables at the top of the file to match your device and likings. Also, at present, all the source mpeg files should have the extensive mpeg and not mpg. I also need to add logic to detect a compatible audio track and copy instead of transcoding to mp3.

Charles
 
* sansampeg.sh.txt (2.05 kB - downloaded 97 times.)
Logged

Offline Strife89

  • Member
  • *
  • Posts: 354
  • Michael Carr
    • Strife89's blog
Re: Can't get the command right to encode video; need help!
« Reply #2 on: January 25, 2008, 09:44:12 PM »
Attached is a text file is was using to conduct edits; this is the last state I saved it in.

Error messages will come in detail later, but on my last attempt, it basically told me it was skipping every frame in the file -- s-l-o-w-l-y, and I had to hit the key to halt the process.

Most errors wouldn't allow encoding to get started.

EDIT: I have no idea how to execute your script!  :-[  (Double clicking it launches a text editor. Dragging it into the terminal window produces this:)
Quote
TERMINAL:
root@CarrDesktop:/home/michael# '/home/michael/Videos/Test/encode.sh'
bash: /home/michael/Videos/Test/encode.sh: Permission denied
* encoder code.txt (0.67 kB - downloaded 98 times.)
« Last Edit: January 25, 2008, 10:10:32 PM by Strife89 »
Logged
Rockbox: Sansa Clip Zip, iPod Color, iRiver H320

Android: Moto X4, Galaxy Tab S2 T710

Offline cpchan

  • Member
  • *
  • Posts: 198
Re: Can't get the command right to encode video; need help!
« Reply #3 on: January 25, 2008, 10:34:24 PM »
Quote from: Strife89 on January 25, 2008, 09:44:12 PM
Error messages will come in detail later, but on my last attempt, it basically told me it was skipping every frame in the file -- s-l-o-w-l-y, and I had to hit the key to halt the process.

This is normal for some input source- wait for it to finish. I tested your commandlines, other then forgetting to add " lavc -lavcopts" in the first 2 examples, they work fine. Boy, is the screen on the c200 small.

Charles


Logged

Offline cpchan

  • Member
  • *
  • Posts: 198
Re: Can't get the command right to encode video; need help!
« Reply #4 on: January 25, 2008, 10:50:30 PM »
Quote from: Strife89 on January 25, 2008, 09:44:12 PM
I have no idea how to execute your script!  :-[  (Double clicking it launches a text editor. Dragging it into the terminal window produces this:)
Quote
TERMINAL:
root@CarrDesktop:/home/michael# '/home/michael/Videos/Test/encode.sh'
bash: /home/michael/Videos/Test/encode.sh: Permission denied

I presume you renamed the script to encode.sh. Do this in a terminal, if you have root access:

Code: [Select]
sudo chmod 755 /home/michael/Videos/Test/encode.sh

if not:

Code: [Select]
chmod u+x /home/michael/Videos/Test/encode.sh

Now put it some where on your path or else you will need to specify where it is, such as:

Code: [Select]
/home/michael/Videos/Test/encode.sh

or  ./encode.sh if you are in the directory where it is.

The syntax to run the script is:

Code: [Select]
encode.sh 

the easiest way to do it is to put all the files you want to transcode into an empty directory. Change to the directory and do:

Code: [Select]
encode.sh *

Charles
« Last Edit: January 25, 2008, 10:55:23 PM by cpchan »
Logged

Offline Strife89

  • Member
  • *
  • Posts: 354
  • Michael Carr
    • Strife89's blog
Re: Can't get the command right to encode video; need help!
« Reply #5 on: January 26, 2008, 11:42:02 AM »
I must seem like a total idiot, but I'm still at a loss. I cannot get the script to run properly.

Code: [Select]
root@CarrDesktop:/home/michael# '/home/michael/sansampeg.sh.txt' 
bash: /home/michael/sansampeg.sh.txt: Permission denied
root@CarrDesktop:/home/michael# sudo chmod 755 /home/michael/Videos/Test/encode.sh.txt
chmod: cannot access `/home/michael/Videos/Test/encode.sh.txt': No such file or directory
root@CarrDesktop:/home/michael# sudo chmod 755 /home/michael/encode.sh.txt
chmod: cannot access `/home/michael/encode.sh.txt': No such file or directory
root@CarrDesktop:/home/michael# 'home/michael/sansampeg.sh.txt'
bash: home/michael/sansampeg.sh.txt: No such file or directory
root@CarrDesktop:/home/michael# sansampeg.sh.txt
bash: sansampeg.sh.txt: command not found
root@CarrDesktop:/home/michael# sansampeg.sh.txt *
bash: sansampeg.sh.txt: command not found
root@CarrDesktop:/home/michael# sansampeg.sh *
bash: sansampeg.sh: command not found
root@CarrDesktop:/home/michael# '/home/michael/sansampeg.sh'
bash: /home/michael/sansampeg.sh: Permission denied
root@CarrDesktop:/home/michael# chmod u+x /home/michael/Videos/Test/encode.sh
chmod: cannot access `/home/michael/Videos/Test/encode.sh': No such file or directory
root@CarrDesktop:/home/michael# chmod u+x encode.sh
root@CarrDesktop:/home/michael# chmod u+x /home/michael/encode.sh
root@CarrDesktop:/home/michael#

Now, I do have WinFF; what I don't seem to have is an mp3 encoder. Is there another audio codec that will work? I can create a new profile and use that instead.
« Last Edit: January 26, 2008, 11:45:36 AM by Strife89 »
Logged
Rockbox: Sansa Clip Zip, iPod Color, iRiver H320

Android: Moto X4, Galaxy Tab S2 T710

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Can't get the command right to encode video; need help!
« Reply #6 on: January 26, 2008, 12:22:02 PM »
mp2 audio works as well.
Logged

Offline Strife89

  • Member
  • *
  • Posts: 354
  • Michael Carr
    • Strife89's blog
Re: Can't get the command right to encode video; need help!
« Reply #7 on: January 26, 2008, 02:03:27 PM »
Except that it doesn't seem to work when I use the sampling rate override to put it at 44000MHz; my file has 22050MHz audio. (No bit rate override was entered.)

Using the included "MPEG 2" preset, and a 150kbps (video bitrate) override, I get a video that plays well in Totem. In Rockbox, however, the whole thing is playing at double speed (I even turned off the "Skip Frames" option!).

EDIT: Wait a second!!! I forgot it should be 44100 MHz; NOT the 44000 MHz I was trying!
« Last Edit: January 26, 2008, 02:05:24 PM by Strife89 »
Logged
Rockbox: Sansa Clip Zip, iPod Color, iRiver H320

Android: Moto X4, Galaxy Tab S2 T710

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Can't get the command right to encode video; need help!
« Reply #8 on: January 26, 2008, 02:04:51 PM »
Are you trying to set it to 44000 and not 44100 (which is the proper number)?

22050 audio will obviously cause it to play at double speed, because Rockbox only works with 44100 and uses the audio for timing purposes...
Logged

Offline Strife89

  • Member
  • *
  • Posts: 354
  • Michael Carr
    • Strife89's blog
Re: Can't get the command right to encode video; need help!
« Reply #9 on: January 26, 2008, 02:06:39 PM »
As seen in my last edit, indeed I am. I'll try it and report back.

(MAN, I feel like a doofus....)

EDIT: That did the trick!

I appreciate all the help you two have offered. Kudos to you all! :)
« Last Edit: January 26, 2008, 02:15:45 PM by Strife89 »
Logged
Rockbox: Sansa Clip Zip, iPod Color, iRiver H320

Android: Moto X4, Galaxy Tab S2 T710

Offline cpchan

  • Member
  • *
  • Posts: 198
Re: Can't get the command right to encode video; need help! [SOLVED]
« Reply #10 on: January 26, 2008, 07:09:22 PM »
I emailed  you a tarball so you don't have to mess with permissions. Don't forget to change the values of the variables at the top of the file to match your player and likings. I forget to say in the email that you should untar.gz it as root.

Charles
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox General
| |-+  Rockbox General Discussion
| | |-+  Can't get the command right to encode video; need help! [SOLVED]
 

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

Page created in 0.077 seconds with 15 queries.