Rockbox Technical Forums

Support and General Use => Plugins/Viewers => Topic started by: Zayger on September 14, 2007, 08:16:30 AM

Title: 5.5g poor Mpeg Playback
Post by: Zayger on September 14, 2007, 08:16:30 AM
Hi,

I have a 30gb 5.5g Video Ipod, I been using rockbox for a while now and love it. My only question is on my particular ipod version is mpeg playback usally poor? My ipod plays audio at the correct speed but on all videos including the elephant dream one, every half second or so it must skip a bunch of frames to keep up with the audio. Until today I thought this maybe just be a codec issue so I decided there was nothing I could do about it an left the apple firmware to do all the video playing. But today a friend of mine installed rockbox on his 1st gen Ipod nano and he says that video playback is for him "as smooth as silk". This seemed strange to me since the ipod video supposable has a better CPU and I would assume that meant its video capabilities were higher.

Any and all information I can get on this subject is useful Thanks.  ;D
Title: Re: 5.5g poor Mpeg Playback
Post by: GodEater on September 14, 2007, 08:18:18 AM
Mpegplayer performs poorly on all iPod videos. The screen is a high resolution, and the processor doing all the work is underpowered for it. Bear in mind - we don't know how to use the Video's built in hardware mpeg decompressor - and likely won't do (if ever) for a very long time.

For this reason we don't recommend using the MpegPlayer plugin on the video - stick to the original firmware for watching movies.

For the record, the CPU in the Nano and the Video is identical - the difference is in the screen resolution. It's much lower on the Nano, and so the processor has to do less work.
Title: Re: 5.5g poor Mpeg Playback
Post by: Zayger on September 14, 2007, 08:23:57 AM
Ok thanks, I had suspected it might have been something to do with the screen resolution. Just glad to clear it up.  :D
Title: Re: 5.5g poor Mpeg Playback
Post by: FujiSkunk on November 05, 2007, 04:32:06 PM
First post, so let me get the obligatory "Rockbox rocks!" out of the way. ;D

For the record, the CPU in the Nano and the Video is identical - the difference is in the screen resolution. It's much lower on the Nano, and so the processor has to do less work.


Would it help if mpegplayer had an option to reduce the output resolution to something like 160x120, and then just windowbox the output?

I have a 80GB 5.5G Video, and while 320x240 video playback gets lots of frame-skipping, I have a 160x120 file that plays just fine.
Title: Re: 5.5g poor Mpeg Playback
Post by: AlexP on November 05, 2007, 05:10:22 PM
Are you suggesting just playing a section of the video or resizing on the fly?

If you are going to do that, since you have to encode for rockbox anyway, why not just encode at a smaller resolution on the first place?
Title: Re: 5.5g poor Mpeg Playback
Post by: GodEater on November 06, 2007, 03:06:35 AM

Would it help if mpegplayer had an option to reduce the output resolution to something like 160x120, and then just windowbox the output?


There isn't a hope in hell that the CPU in the ipod is powerful enough to do this on the fly.

Quote

I have a 80GB 5.5G Video, and while 320x240 video playback gets lots of frame-skipping, I have a 160x120 file that plays just fine.


So just encode all your videos at that resolution.
Title: Re: 5.5g poor Mpeg Playback
Post by: FujiSkunk on November 06, 2007, 10:04:19 AM
Are you suggesting just playing a section of the video or resizing on the fly?


Resizing on the fly.

Quote
If you are going to do that, since you have to encode for rockbox anyway, why not just encode at a smaller resolution on the first place?


I didn't encode this file specifically for Rockbox; it was one from my collection that happened to "just work."  I figured that if the CPU were able to play other MPG files at a lower resolution (and GodEater is saying it can't, so this may be moot), then you wouldn't have to do as many re-encodings just to get something to play.


There isn't a hope in hell that the CPU in the ipod is powerful enough to do this on the fly.


So the CPU isn't even powerful enough to decode 320x240 in realtime?  If that's true, then yeah, resizing the output won't help.

How does the Nano handle 320x240 files?  Does it just refuse to play them altogether?
Title: Re: 5.5g poor Mpeg Playback
Post by: AlexP on November 06, 2007, 10:25:35 AM

I figured that if the CPU were able to play other MPG files at a lower resolution (and GodEater is saying it can't, so this may be moot), then you wouldn't have to do as many re-encodings just to get something to play.


It is perfectly capable of playing files of lower resolution, as it doesn't resize them, they just don't fill the screen.  In fact it plays them better as it is easier to decode the files and update the screen.  What we cannot do is resize the videos.  In order to do that we would need processor power to decode the video, then more processor power to resize it, then processor power to update the screen.  You are just adding an extra step of processor intensive calculation, thereby making the performance much worse than if we didn't resize.


So the CPU isn't even powerful enough to decode 320x240 in realtime?  If that's true, then yeah, resizing the output won't help.


You already know the CPU isn't powerful enough, seeing as in a previous post you told us your videos were skipping.


How does the Nano handle 320x240 files?  Does it just refuse to play them altogether?


I don't know, but I think it just displays the portion that will fit on screen.  Thre is no way an iPod can resize on the fly - use that big powerful computer sat on your desk instead!
Title: Re: 5.5g poor Mpeg Playback
Post by: FujiSkunk on November 06, 2007, 11:16:18 AM
It is perfectly capable of playing files of lower resolution, as it doesn't resize them, they just don't fill the screen.  In fact it plays them better as it is easier to decode the files and update the screen.  What we cannot do is resize the videos.  In order to do that we would need processor power to decode the video, then more processor power to resize it, then processor power to update the screen.  You are just adding an extra step of processor intensive calculation, thereby making the performance much worse than if we didn't resize.

It's true that resizing would be an extra step, but I was wondering if that could be offset by making displaying be a less CPU-intensive step.  Presumably displaying 160x120 video takes less work than displaying 320x240 video, regardless of the source.  I'm basing this on my experience with an old PowerMac 7300, which had a 200MHz PPC processor and no dedicated video hardware.  The smaller I made the window, the better performance I got.

Quote
So the CPU isn't even powerful enough to decode 320x240 in realtime?  If that's true, then yeah, resizing the output won't help.

You already know the CPU isn't powerful enough, seeing as in a previous post you told us your videos were skipping.

I know that the CPU isn't powerful enough for decode+display, yes.  I was asking if it is powerful enough for decode without display.  If it isn't, and I now gather it isn't, then I agree resizing won't help.
Title: Re: 5.5g poor Mpeg Playback
Post by: GodEater on November 06, 2007, 12:58:33 PM

I know that the CPU isn't powerful enough for decode+display, yes.  I was asking if it is powerful enough for decode without display.  If it isn't, and I now gather it isn't, then I agree resizing won't help.


What would be the point of decoding a video only to then not display it ? I'm not sure I see what you want to achieve here ?
Title: Re: 5.5g poor Mpeg Playback
Post by: FujiSkunk on November 06, 2007, 01:04:39 PM


I know that the CPU isn't powerful enough for decode+display, yes.  I was asking if it is powerful enough for decode without display.  If it isn't, and I now gather it isn't, then I agree resizing won't help.


What would be the point of decoding a video only to then not display it ? I'm not sure I see what you want to achieve here ?


If the CPU is fast enough to decode a 320x240 video without displaying it, then perhaps decoding, resizing, and displaying at 160x120 would take less CPU than decoding and displaying at 320x240.  I don't know for sure that it would, but I'm basing this thought on previous experience.

If the CPU is not fast enough to decode a 320x240 video without displaying it, then obviously this isn't worth pursuing.
Title: Re: 5.5g poor Mpeg Playback
Post by: GodEater on November 07, 2007, 04:06:23 AM
Decoding the video isn't the hard bit - resizing it is. That is orders of magnitude more work than decoding or displaying. The iPod is not up to it.
Title: Re: 5.5g poor Mpeg Playback
Post by: FujiSkunk on November 07, 2007, 11:50:16 AM

Decoding the video isn't the hard bit - resizing it is. That is orders of magnitude more work than decoding or displaying. The iPod is not up to it.


I see.  What if it isn't a smooth rescaling, but a simple dropping of pixels?
Title: Re: 5.5g poor Mpeg Playback
Post by: linuxstb on November 07, 2007, 12:42:56 PM
It's possible that downscaling the video will give noticable speed improvements (mplayer has a "lowres" option in its mpeg decoder which I think downscales by 50% in the same way as the Rockbox jpeg decoder does).

But personally I don't think it's worth the time and effort to implement it - you will get much better results by re-encoding the video, rather than wasting CPU cycles (and battery) decoding files larger than you're displaying.  Remember we are stretching the ipod's main CPU to breaking point by getting it to decode video, so we need to give it all the help we can - not hinder it.
Title: Re: 5.5g poor Mpeg Playback
Post by: FujiSkunk on November 07, 2007, 01:37:06 PM
But personally I don't think it's worth the time and effort to implement it - you will get much better results by re-encoding the video, rather than wasting CPU cycles (and battery) decoding files larger than you're displaying.


That makes sense.  I was thinking that if this was enough to get smooth playback, then another round of re-encodings wouldn't be necessary, and users could decide which they like better, video that fills the screen or video that doesn't skip.

But battery usage is a good point.  If true 160x120 video requires less battery to play than scaled 160x120 video, then I can agree re-encoding should be encouraged.

Thanks again for a great bit of software, guys.  If it weren't for Rockbox, I wouldn't have an iPod (and I wouldn't have returned the iPod Classic I originally bought).
Title: Re: 5.5g poor Mpeg Playback
Post by: cool_walking_ on November 07, 2007, 07:10:11 PM
You can get faster playback by decreasing framerate, obviously because MpegPlayer doesn't have to decode as many frames.  I find that 12 fps is the lowest I can get before the video starts to look choppy, but your eyes may differ. 320x180 runs fine at 12fps. I'm not sure if 320x240 at 12fps would still run well, but this chart (http://www.rockbox.org/twiki/bin/view/Main/PluginMpegplayer#Performance) seems to indicate so.  Note that there was a performance increase at r15341.