OESF Portables Forum

Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: JerryAttrix on December 24, 2005, 06:07:25 am

Title: Video Encoder Settings
Post by: JerryAttrix on December 24, 2005, 06:07:25 am
I've been experimenting with various mencoder options (on my SuSE 9.3 PC) to get something that works optimally on the Z.   A typical command is

mencoder $1 -o $2.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:vqmin=2:vqmax=20:vmax_b_frames=2:vbitrate=192:vqcomp=0.6:vpass=
 -vf scale=320:240,eq=6 -oac mp3lame -lameopts abr:br=64:aq=1 -srate 24000

but XMMS plays the result with the sound leading the video by a second or more.  Also I'd like to run full-screen but the results are always jerky.  On Cacko using kino I had some success by rotating the video and sizing to 480x640, but everything I encoded recently played with no video at all, which was the main reason I moved to pdaXrom.

Does anyone have a recommendation?
Title: Video Encoder Settings
Post by: urielka on December 24, 2005, 07:35:22 am
run it by using mplayer -vo bvdd -vm name.avi
by command line it should run the best.
i use this:
Code: [Select]
mencoder $1 -srate 24000 -vop scale=320:240 -o z.$1 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=320:vhq:acodec=mp3:abitrate=64  -sws 2 -oac lavcthe diffrence is that i use 320 for video bitrate and u use 192 does 192 is good quality?
Title: Video Encoder Settings
Post by: Meanie on December 24, 2005, 08:21:33 am
Quote
run it by using mplayer -vo bvdd -vm name.avi
by command line it should run the best.
i use this:
Code: [Select]
mencoder $1 -srate 24000 -vop scale=320:240 -o z.$1 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=320:vhq:acodec=mp3:abitrate=64  -sws 2 -oac lavcthe diffrence is that i use 320 for video bitrate and u use 192 does 192 is good quality?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=108357\"][{POST_SNAPBACK}][/a][/div]

if you want better quality then you can use 2 phase encoding with the following options:

1st phase -

mencoder $1 -o $2 -oac copy -vf scale=320:240,eq2=1.0:1.0:0.03:1.0 -sws 2 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=248:vpass=1 -ffourcc DX50

2nd phase -

mencoder $1 -o $2 -srate 22050 -oac mp3lame -lameopts mode=3:cbr:br=24 -vf scale=320:240,eq2=1.0:1.0:0.03:1.0 -sws 2 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=248:vpass=2 -ffourcc DX50
Title: Video Encoder Settings
Post by: urielka on December 24, 2005, 09:44:58 am
will it be as good as 320 kbit rate?
Title: Video Encoder Settings
Post by: JerryAttrix on December 27, 2005, 12:11:32 pm
Quote
run it by using mplayer -vo bvdd -vm name.avi
the diffrence is that i use 320 for video bitrate and u use 192 does 192 is good quality?
Nope; it's pretty poor.  I only did it to pack as much as possible in (though looking at 2-phase results I see I wasn't saving anything).  But I don't worry about the picture too much; I use it mainly for foreign language videos where the sound is the key.

I did the 2-phase encoding as recommended and the results are exceptional.  However, XMMS still plays the sound faster than the video.  Going to the console results in the following:

# mplayer -vo bvdd -vm /mnt/card/bg01.avi
Failed to open /dev/rtc: Device or resource busy (it should be readable by the user.)
Playing /mnt/card/bg01.avi
Cache fill: 0.00% (0 bytes) AVI file format detected.
VIDEO: [FMP4] 320x240 24bpp 25.000 fps 193.2 kbps (23.6 kbyte/s)
Clip info:
 Software: MEncoder SuSE Linux 9.3 (i686)-Packman-3.3.5
=======================================
Requested audio codec family [mp3] (afm=mp3lib) not available.
Enable it at compilation.
Opening audio decoder: [libmad] libmad audio decoder
AUDIO: 24000 Hz, 2 ch, s161e, 8.0 kbit/1.04% (ratio: 1000->96000)
Selected audio codec: [mad] (libMAD MPEG layer 1-2-3)
=======================================
Error opening/initializing the selected video_out (-vo) device.
Exiting...

I can't find bvdd listed; what is it?
Title: Video Encoder Settings
Post by: pgas on December 27, 2005, 12:35:52 pm
I'm not a specialist but I think that with a 860 you should use -vo w100 and not -vo bvdd, also add -nortc to the list of options.

bvdd is for C1000/3000/3100
Title: Video Encoder Settings
Post by: grog on February 06, 2006, 06:49:54 am
Quote
if you want better quality then you can use 2 phase encoding with the following options:

1st phase -

mencoder $1 -o $2 -oac copy -vf scale=320:240,eq2=1.0:1.0:0.03:1.0 -sws 2 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=248:vpass=1 -ffourcc DX50

2nd phase -

mencoder $1 -o $2 -srate 22050 -oac mp3lame -lameopts mode=3:cbr:br=24 -vf scale=320:240,eq2=1.0:1.0:0.03:1.0 -sws 2 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=248:vpass=2 -ffourcc DX50[div align=\"right\"][a href=\"index.php?act=findpost&pid=108358\"][{POST_SNAPBACK}][/a][/div]
Hey Meanie. I'm trying your tip on my poodle, and while the video is a lot better than this one phase command that I tried:

Code: [Select]
mencoder %1 -srate 24000 -ofps 15 -sws 2 -ovc lavc -vf scale=320:240,eq2=1.0:0.6:0.1:0.7 -lavcopts vcodec=mpeg4:vhq:vbitrate=150 -lameopts cbr:br=64:mode=3 -vop scale=320:240 -oac mp3lame -ffourcc XVID -o %2I'm having the same problem as JerryAttrix that the audio is out of phase. Any suggestions? thks
Title: Video Encoder Settings
Post by: adf on February 06, 2006, 07:57:36 pm
try divx 5, like meanie did, or try ffmpeg.

Have you tried avidemux2?   I find it really handy.
Title: Video Encoder Settings
Post by: grog on February 06, 2006, 10:24:03 pm
Quote
try divx 5, like meanie did, or try ffmpeg
I'm trying some videos, using fourcc XVID. Is this what you mean?

Quote
Have you tried avidemux2?   I find it really handy.[div align=\"right\"][a href=\"index.php?act=findpost&pid=113922\"][{POST_SNAPBACK}][/a][/div]
As opposed to mencoder you mean? No, but I'll check it out.

Another thing I tried was playing the videos with opie-mediaplayer2/xine. No luck yet; gave the error there was no demuxer available. I'm trying the above XVID in hopes that'll fix that.
Title: Video Encoder Settings
Post by: dbowden on February 25, 2006, 11:39:10 pm
Quote
I'm having the same problem as JerryAttrix that the audio is out of phase. Any suggestions? thks

It does seem to be an encoding issue.

I noticed the same thing myself, but only on one video I encoded using the instructions at: http://www.cs.unc.edu/~hensley/zaurus/encode.html (http://www.cs.unc.edu/~hensley/zaurus/encode.html).

Videos I downloaded from the web seem to work OK, as did another video I encoded using the exact same method (2nd track on the DVD worked OK, 1st track was off).

I fixed it by adjusting the audio delay by about 2.2 seconds.  The command line option is "-delay -2.2", so for that video, I use:
mplayer -vo bvdd -vm -delay -2.2 videoname.avi

I used the commands + and - during playback to find out the correct setting.  It may vary for you.

Hope this helps,

David
Title: Video Encoder Settings
Post by: datajerk on February 26, 2006, 11:11:42 am
I no longer have problems with 320x240, 512bit, 30 frames/sec and Kino/Cacko 1.23 on my c860 using:

Code: [Select]
mencoder $1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320x240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=1 -oac copy -sws 2 -o output.avi

mencoder $1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320x240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=2 -oac copy -sws 2 -o output.avi
I have not had the time to find the best options for highest quality output, but the above did fix all my audio sync problems with TiVo content.  It's spot on and looks great.  A similar setup also worked for my kids video iPod, i.e. no audio sync issues.

For DVDs an -ofps of 24000/1001 may solve the problem.  I have not tried DVDs yet.  Other settings for -ofps, using -noskip, and 3 pass encoding (don't ask me to recall all combinations) created the audio sync issues.

I don't know about newer units (c1000, c3xxx), but the c860 performs much better with prerotation.

On playback I did have to add to Kino General/Advanced options/Options for mplayer '-fs' to get full screen.  Under Video, uncheck all tabs, except Drop frames and Disable aspect ratio correction.  And, overclock on playback.

The actual playback options are:
Code: [Select]
-slave -nortc -quict -ac -mp3 -noaspect -vo w100 -nodouble -dr -framedrop -nocache -fs file...I hope this helps.  I have been fighting audio sync problems for months.

Lastly I read that 640x480 is possible with good performance with c[13]??? models.  I plan to upgrade when the next releases.  Does any know if you have to prerotate to get good performance with c[13]??? models?
Title: Video Encoder Settings
Post by: grog on March 02, 2006, 08:34:56 pm
Quote
I no longer have problems with 320x240, 512bit, 30 frames/sec and Kino/Cacko 1.23 on my c860 using:

Code: [Select]
mencoder $1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320x240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=1 -oac copy -sws 2 -o output.avi

mencoder $1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320x240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=2 -oac copy -sws 2 -o output.avi
[div align=\"right\"][a href=\"index.php?act=findpost&pid=116143\"][{POST_SNAPBACK}][/a][/div]
I've modified the lines so that they'll (almost) run on my 'doze box:

Code: [Select]
c:\progra~1\mplayer\mencoder %1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320:240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=1 -oac copy -sws 2 -o %2

c:\progra~1\mplayer\mencoder %1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320:240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=2 -oac copy -sws 2 -o %2
But I can't get past this error:

Code: [Select]
F:\zvids>encode-movie infile.avi avi outfile.avi
MEncoder 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Northwood (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled with runtime CPU detection - WARNING - this is not optimal!
To get best performance, recompile MPlayer with --disable-runtime-cpudetection.
File not found: 'frameno.avi'
Failed to open frameno.avi
Option lavcopts: Unknown suboption -ofps

Exiting... (error parsing cmdline)
I don't see 'frameno.avi' anywhere on the command line, and I've used the '-ofps' options in other attempts. Any ideas anyone? thks
Title: Video Encoder Settings
Post by: adf on March 02, 2006, 10:24:53 pm
hmmm. Maybe a codec issue?

Which reminds me... I had less luck with Xvid than I did with ffmpeg. Xvid, imho looks better on a large screen, &tc... playback on a z with ffmpeg encoding and mplayer has been better in my experience.
 
I recommend avidemux2 as it is a handy gui based app  --easier to tinker on if you encode intermmitently and have that "wtf did i do to make this work just so last time?" experience, like I do.

 I also have done better with ogg audio and a .ogm wrapper. at the very least you can get away with compressing the audio a bit further and shunting the little extra bit of space you saved to the video stream.
Title: Video Encoder Settings
Post by: datajerk on March 02, 2006, 11:27:48 pm
My bad.  I C&P the command wrong.  Switch -ofps 30000/1001 with the vcodec=... line.

Command should be:
Code: [Select]
c:\progra~1\mplayer\mencoder %1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320:240,rotate=1 -ovc lavc -lavcopts  vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=2 -ofps 30000/1001 -oac copy -sws 2 -o %2
Title: Video Encoder Settings
Post by: grog on March 05, 2006, 12:40:40 pm
Quote
My bad[div align=\"right\"][a href=\"index.php?act=findpost&pid=116777\"][{POST_SNAPBACK}][/a][/div]
Thanks for the update. I've been playing & tweaking & reading man pages & docs over the last week & finally came up with this. I's the same as yours except that my 5600 didn't seem to like mencoder doing the pre-rotate, so I took that out & I removed the extra '-oac copy' option, which I wasn't sure why you had it in there although it doesn't seem to break anything.

Code: [Select]
c:\progra~1\mplayer\mencoder %1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320:240 -ovc lavc -lavcopts vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=1 -ofps 30000/1001 -sws 2 -o %2

c:\progra~1\mplayer\mencoder %1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320:240 -ovc lavc -lavcopts vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=2 -ofps 30000/1001 -sws 2 -o %2
And here's the mplayer options I use to play. The mad audio codec seems to works better for me & my mplayer doesn't have w100 so I swtiched to fbdev. Ihe input is so that my key settings for playing mp3's don't effect movie playback. I'll even 'chvt 1' & play them in a separate virtual terminal 'cause there's some minor artifacts on the screen when I play in a gui terminal.

Code: [Select]
mplayer -nortc -quiet -ac mad -noaspect -vo fbdev -nodouble -dr -framedrop -nocache -fs -brightness 20 -input conf=/dev/null $@Thanks again
Title: Video Encoder Settings
Post by: rsay on March 11, 2006, 09:47:40 am
I have been using ffmpeg with good results. I got the recipe from the ubuntu forums:

ffmpeg -i input_file.avi -f mp4 -vcodec mpeg4 -maxrate 1000 -b 700 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -ab 192 -s 320x240 -aspect 4:3 output_file.mov

I playback on my 3100 with:

mplayer -vm -ao oss -vo bvdd:rotate=-1 output_file.mov

There is also a gui for ffmpeg specifically for this purpose called VIVE available on sourceforge.

Here is the link to the forum discussion: Video encoding for ipod (http://www.ubuntuforums.org/showthread.php?t=114946)

Here is the link to the vive project on sourceforge:VIVE (http://vive.sourceforge.net/)
Title: Video Encoder Settings
Post by: ostense on March 14, 2006, 07:25:21 am
Quote
Quote
I no longer have problems with 320x240, 512bit, 30 frames/sec and Kino/Cacko 1.23 on my c860 using:

Code: [Select]
mencoder $1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320x240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=1 -oac copy -sws 2 -o output.avi

mencoder $1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320x240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=2 -oac copy -sws 2 -o output.avi
[div align=\"right\"][a href=\"index.php?act=findpost&pid=116143\"][{POST_SNAPBACK}][/a][/div]
I've modified the lines so that they'll (almost) run on my 'doze box:

Code: [Select]
c:\progra~1\mplayer\mencoder %1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320:240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=1 -oac copy -sws 2 -o %2

c:\progra~1\mplayer\mencoder %1 -oac mp3lame -lameopts cbr:br=128:mode=0 -vf pp=lb,scale=320:240,rotate=1 -ovc lavc -lavcopts -ofps 30000/1001 vcodec=mpeg4:vhq:v4mv:vbitrate=512:vpass=2 -oac copy -sws 2 -o %2
But I can't get past this error:

Code: [Select]
F:\zvids>encode-movie infile.avi avi outfile.avi
MEncoder 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Northwood (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled with runtime CPU detection - WARNING - this is not optimal!
To get best performance, recompile MPlayer with --disable-runtime-cpudetection.
File not found: 'frameno.avi'
Failed to open frameno.avi
Option lavcopts: Unknown suboption -ofps

Exiting... (error parsing cmdline)
I don't see 'frameno.avi' anywhere on the command line, and I've used the '-ofps' options in other attempts. Any ideas anyone? thks
[div align=\"right\"][a href=\"index.php?act=findpost&pid=116753\"][{POST_SNAPBACK}][/a][/div]

Hi !
frameno.avi is made automatic by the pass 1 and automatic taken as input to the pass 2 run so if the pass 2 do not find it something went wrong in the pass 1.
Title: Video Encoder Settings
Post by: datajerk on March 14, 2006, 11:14:51 am
Quote
Thanks for the update. I've been playing & tweaking & reading man pages & docs over the last week & finally came up with this. I's the same as yours except that my 5600 didn't seem to like mencoder doing the pre-rotate, so I took that out & I removed the extra '-oac copy' option, which I wasn't sure why you had it in there although it doesn't seem to break anything.

...
Is your audio sync issue solved?
Title: Video Encoder Settings
Post by: grog on March 15, 2006, 01:13:58 pm
Quote
Quote
Thanks for the update. I've been playing & tweaking & reading man pages & docs over the last week & finally came up with this. I's the same as yours except that my 5600 didn't seem to like mencoder doing the pre-rotate, so I took that out & I removed the extra '-oac copy' option, which I wasn't sure why you had it in there although it doesn't seem to break anything.
Is your audio sync issue solved?[div align=\"right\"][a href=\"index.php?act=findpost&pid=118529\"][{POST_SNAPBACK}][/a][/div]
It seems to be (with the above changes). As well, don't try yo encode more than one video at a time (at least not under windows). You'll eventually get an error about not being able to open the video driver. As long as you encode one at a time, all goes ok.

I'm also eventually going to try ffmpeg as suggested earlier to see if that's any easier/reliable. As time permits, of course.

Thanks all for the help.
Title: Video Encoder Settings
Post by: DaddyGeek on March 16, 2006, 01:53:05 am
One option I don't see people mentioning is the "-framedrop" for mplayer.

I find I add this to any video playback for my C3000 OR 5500 with mplayer and I tend to get quite decent results and no drastically noticeable disruption of viewability.

This seems to help the audio which seems to be the dog in most of the different formats I have tried.

I have to admit I use Windows (shhhh) to do the encoding, but I run DivX (or xVid) with a rate of 256 or 512 for the encoding with MP3 audio at approx 192 kbps and the playback seems quite good.