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:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  Mencoder and VBR MPEG-2 settings for Mpegplayer
« previous next »
  • Print
Pages: [1]

Author Topic: Mencoder and VBR MPEG-2 settings for Mpegplayer  (Read 6466 times)

Offline nonoitall

  • Member
  • *
  • Posts: 8
Mencoder and VBR MPEG-2 settings for Mpegplayer
« on: May 22, 2008, 07:17:30 AM »
I'm transcoding some TV episodes to MPEG-2 for Mpegplayer using mencoder and was wondering what settings are ideal for a VBR encode?  In particular, what's typically a good maximum bitrate in order to avoid too many dropped frames?  (The source material is 23.98 fps.)  Also, when using mencoder's vrc_maxrate option, I'm required to provide a value for vrc_buf_size.  I don't really have any idea what a good value would be here for Mpegplayer. :D

Anyway, I'm sure some of the answers to my questions are somewhat subjective, but I'm just hoping you guys can give me an idea of what ballpark I should be in.  Thanks in advance!
Logged

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #1 on: May 22, 2008, 07:24:39 AM »
You left out a rather crucial bit of information: Which player. They have varying processors and hardware that affect the playback speed dramatically.
Logged

Offline bascule

  • Rockbox Expert
  • Member
  • *
  • Posts: 1298
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #2 on: May 22, 2008, 07:26:45 AM »
Surely that depends on the target device... ipod 5g cannot run fullscreen at 30fps, but the nano can

The following link opens the list of presets for use with WinFF and should be a good starting point for settings:

http://www.rockbox.org/twiki/pub/Main/PluginMpegplayer/presets.xml
Logged
DataBase fanboy and author of the totally overhauled Rockbox Sync Tool

Offline nonoitall

  • Member
  • *
  • Posts: 8
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #3 on: May 22, 2008, 04:49:01 PM »
I'm doing several encodes for several targets, actually.  Thanks for the link to the WinFF presets - it didn't occur to me to look there.  Would those bitrates listed in the WinFF presets be fairly good maximum bitrates for mencoder?  If so, I'm still a little lost when it comes to the VRC buffer size though.
Logged

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #4 on: May 22, 2008, 05:32:33 PM »
They're actually average bitrates for a single-pass encode. They might even be a bit low, depending on target. The Gigabeat F for example can essentially handle most bitrates you would even remotely reasonably encode 320x240 video at as far as my personal test go. Your best bet is to just pick the bitrate based on what quality you'd like to see (or try a constant quantizer scale) and then if it has performance issues lower it a bit.
Logged

Offline nonoitall

  • Member
  • *
  • Posts: 8
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #5 on: May 22, 2008, 08:35:57 PM »
Okay thanks, I guess I'll do some trial and error.  Now, what about the VRC buffer size? :)
Logged

Offline nonoitall

  • Member
  • *
  • Posts: 8
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #6 on: May 27, 2008, 12:45:47 AM »
I guess the other name for that would be VBV buffer size.  Anyone know what this is for Mpegplayer?
Logged

Offline cool_walking_

  • Rockbox Expert
  • Member
  • *
  • Posts: 695
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #7 on: May 27, 2008, 02:33:00 AM »
I have no idea what a VRC/VBV buffer is...

Leave it at the default? Look through your encoder documentation for examples? Try something and see if it works?
« Last Edit: May 27, 2008, 02:43:28 AM by cool_walking_ »
Logged

Offline nonoitall

  • Member
  • *
  • Posts: 8
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #8 on: May 27, 2008, 03:44:58 AM »
There is no default - whenever you set a maximum bitrate you must set the VBV buffer size as well.  The only examples provided in mencoder's documentation are for VCD, SVCD and DVD.  I'm trying to encode for some targets that I don't necessarily own, so the try-and-see method isn't really giving me a very good, complete picture of whether certain settings are okay or not.
Logged

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #9 on: May 27, 2008, 03:54:59 AM »
Why are you still worrying about a maximum bitrate?

Since you can't even test it on targets you don't own, there's no way to determine what maximum bitrate causes performance problems anyway, so shouldn't your goal either be a target quality, or a target filesize, instead?
Logged

Offline nonoitall

  • Member
  • *
  • Posts: 8
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #10 on: May 27, 2008, 06:27:57 AM »
Some of the videos I'm encoding are about 90% still scenes, with high motion in between.  If I don't set a maximum bitrate, the in-between areas will use an unacceptably high bitrate that will result in jerky playback.  The target players I do have have revealed this.
Logged

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #11 on: May 27, 2008, 06:30:29 AM »
What target bitrate are you using, and what player are you encoding for?
Logged

Offline nonoitall

  • Member
  • *
  • Posts: 8
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #12 on: May 27, 2008, 07:57:51 AM »
My desired average bitrate varies from target to target, but for smaller screen sizes (176x132 or under) I'm using ~200kbps.  320x240 targets, 300-400kbps, and others somewhere in between.  For 220x176 targets (the ones I've been working on the most) it seems like a buffer size of 46KB works well for my 200-250kbps (with 400kbps maximum bitrate) encodes.  (I dug that size out of some IRC log of the RB developers.)

However, the same doesn't hold true for 320x240 encodes, which throw out many buffer underflow warnings even when I quadruple that buffer size.  I was doing some experimenting and it seems that in those cases, the maximum bitrate is not respected.  (I can set an average of 300kbps and a maximum of 400kbps, but the file will still have a peak bitrate of over 1Mbps.)

I can post the command lines I'm using and the results I'm getting tomorrow if that would help.
Logged

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #13 on: May 27, 2008, 04:57:54 PM »
I asked for specific targets, not target screen size. For example our 320 by 240 players have vastly varying performance. I'd also need to know what frame rate you're encoding at For each one.
Logged

Offline nonoitall

  • Member
  • *
  • Posts: 8
Re: Mencoder and VBR MPEG-2 settings for Mpegplayer
« Reply #14 on: May 27, 2008, 06:58:40 PM »
Gigabeat, iAudio X5, iPod Color/Photo, iPod Nano, iPod Video, iriver H10 5/6GB, iriver H10 20GB, iriver H120, iriver H300, Sansa c200, Sansa e200.

The video is 23.976 fps.

I finally did manage to get mencoder to do the 320x240 encode earlier this afternoon, but I had to bump the buffer size up past 65,536 kbits (8,000 KB) to do it.  This seems awfully excessive, since it's over 35 times the size that DVD video uses.  Here are my attempts:
Code: [Select]
#220x166 easily encodes:

#First pass
mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=200:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=376:vpass=1 \
  -vf scale=220:166,harddup -o /dev/null
# ^ this goes fine

#Second pass
mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=200:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=376:vpass=2 \
  -vf scale=220:166,harddup -o test.m2v
# ^ this goes fine
Code: [Select]
#Now for 320x240...

mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=376:vpass=1 \
  -vf scale=320:240,harddup -o /dev/null
# ^ results in buffer underflow warnings (maybe 15-20 of them)

mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=376:vpass=2 \
  -vf scale=320:240,harddup -o test.m2v
# ^ results in tons and tons and tons of buffer underflow warnings
Code: [Select]
mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=1507:vpass=1 \
  -vf scale=320:240,harddup -o /dev/null
# ^ this goes fine

mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=1507:vpass=2 \
  -vf scale=320:240,harddup -o test.m2v
# ^ results in tons and tons and tons of buffer underflow warnings
Code: [Select]
mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=1835:vpass=1 \
  -vf scale=320:240,harddup -o /dev/null
# ^ this goes fine

mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=1835:vpass=2 \
  -vf scale=320:240,harddup -o test.m2v
# ^ results in tons and tons and tons of buffer underflow warnings
Code: [Select]
mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=8192:vpass=1 \
  -vf scale=320:240,harddup -o /dev/null
# ^ this goes fine

mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=8192:vpass=2 \
  -vf scale=320:240,harddup -o test.m2v
# ^ results in tons and tons and tons of buffer underflow warnings
Code: [Select]
mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=65536:vpass=1 \
  -vf scale=320:240,harddup -o /dev/null
# ^ this goes fine

mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=65536:vpass=2 \
  -vf scale=320:240,harddup -o test.m2v
# ^ results in tons and tons and tons of buffer underflow warnings
Code: [Select]
mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=524288:vpass=1 \
  -vf scale=320:240,harddup -o /dev/null
# ^ this goes fine

mencoder intro.avi -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=300:vmax_b_frames=4:vrc_maxrate=400:vrc_buf_size=524288:vpass=2 \
  -vf scale=320:240,harddup -o test.m2v
# ^ this goes fine - finally!!!
Oddly, even though the last encode didn't spout out any complaints, mplex still warns that there are frame data under-runs detected when I mux the video with its audio, and the video's bitrate peak is over 1.7 Mbps.
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  Mencoder and VBR MPEG-2 settings for Mpegplayer
 

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

Page created in 0.085 seconds with 14 queries.