This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#7487 - mpegplayer - video start time seek with resume
Attached to Project:
Rockbox
Opened by Brian Morey (Morey) - Thursday, 26 July 2007, 20:13 GMT+2
Last edited by Robert Kukla (roolku) - Tuesday, 09 October 2007, 23:39 GMT+2
Opened by Brian Morey (Morey) - Thursday, 26 July 2007, 20:13 GMT+2
Last edited by Robert Kukla (roolku) - Tuesday, 09 October 2007, 23:39 GMT+2
|
DetailsThis patch adds the following functionality to the mpegplayer plugin:
Start up menu for control of movie playback: The startup menu allows for control where the video files are started. The user can select to play the movie from the beginning, resume based on a bookmark, or select a time in minutes to begin. A slider function has been added to aid in time selection. Additionally, a thumbnail is actively drawn that follows the slider position to show the user visually the position in the movie. Resume feature: The resume feature incorporates a circular buffer of 3 movie titles and resume times stored inside the mpegplayer.cfg file. When selecting a movie title, the .cfg file is checked for a resume time on that title, then a startup menu will allow you to play the movie from the beginning or resume (time of 0 if not found) based on the bookmark. The resume bookmark is updated with the last movie start time or the last exit time (not movie ending), whichever occurs last. It the title is not in the .cfg file, a new entry is made in place of the oldest resume entry. Set start time: The startup menu allows the user to select a start time to begin play. By using a slider widget to select a number of minutes into the file, a thumbnail of the movie frame at that time will be displayed. Upon selecting the thumbnail of choice the movie will start playback from that time. NOTES: This patch has been tested on the Sandisk Sansa e200 series device, the ipod simulator, and the gigabeat simulator. Please post results of other platforms. This patch has been written by: John S. Gwynne Brian J. Morey |
This task depends upon
Charles
missing packet start code prefix : 00 at 5000
Then works as expected (I think :P)
Gigabeat F20 latest SVN build.
Also, there's no way of leaving the start menu other than playing the video. I'd like it so that if I accidentally choose the wrong video, I can just press a button and return to the file tree, instead of HAVING to play the file and exiting from there. Otherwise great work!
Also, same request as above. but what would be really useful would be to integrate the startup menu with the mpeg player menu (or even just the seek function).
I've only tried it on one file. It works fine, but that's just a bit annoying.
Sansa e250.
Revision: 14041
Thanks!
-Donald J
iPod Nano
I am using the Gigabeat F40 and I thought I should let you know of these problems.
Features added in this patch:
() quit option from the startup menu
All the videos that work without the patch work with it.
GRaTT
Veralis, please post whether this fixes your issues using the Gigabeat.
http://www.rockbox.org/twiki/bin/view/Main/PluginMpegplayer#Elephants_Dream
Now i just need find a way to encode my videos to work with it now. I have been using Xilisoft Video Converter 3 to encode my old videos that don't work with this patch. So if you can look into making it compatible I would appreciate it.
Thank you for all your hard work on this patch!
Elepahnts Dream: Video: MPEG2 Video 320x240 24.00fps 7500Kbps [Video]
Audio: MPEG Audio Layer 3 44100Hz stereo 128Kbps [Audio]
My Videos: Video: MPEG2 Video 320x240 25.00fps 104857Kbps [Video]
Audio: MPEG Audio 44100Hz stereo 192Kbps [Audio]
Elephant's Dream works perfectly (aside from Sansa being too slow for full 24 fps)
Files encoded with mencoder (oct 2006's and yesterday's build of mencoder had same results) using the following options work fine until your patch is installed:
mencoder input.avi -of mpeg -oac lavc -lavcopts acodec=mp2:abitrate=128 -af resample=44100:0:0 -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=250 -vf scale,harddup -ofps 12 -zoom -xy 220 -o output.mpg
As I said before, the only problem with these files is that they won't start from the beginning or 0 seconds. Let me know if you'd rather me just send you an example of a mpeg encoded like this.
Thanks for all the effort... Great work so far!
As far as encoding goes, I have the Sansa player and here is the way I am encoding my videos using mencoder:
mencoder input.vob -of mpeg -oac lavc -lavcopts acodec=mp2:abitrate=192 -af resample=44100:0:0 -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=469 -vf scale=224:176,harddup,eq2=1.0:2:.4:1.0:1.0:1.0:1.0:1.0 -ofps 15 -o output.mpg
(where input.vob can be any input video)
missing packet start code prefix: 00 at F000
Is there something I am missing.
Current setup:
Latest Build r14343M
AA, BMP-Resize, & this patch
Gigabeat F40
Mediacoder for encoding videos below are my video settings
Bitrate: 500kbps
Codec: MPEG2
Frame Rate: 30fps
MP3: 128kbps
Everything now works perfectly with this plugin on my gigabeat build.
I would do it myself, but I am not big on any type of coding.
Also, I'm going to try a different encoder but mediacoder set with:
Video: 320x240 (I've tried from 600kbps to 2000kbps)
Format: MPEG
Container: MPEG
Audio: LAME MP3 44.1khz Stereo CBR 128KBPS
And everytime I start playback I get the beginning skipping, slowing down almost to a stop, and then slowly going up to speed and playing normally.
I would do it myself, but I am not big on any type of coding.
Also, I'm going to try a different encoder but mediacoder set with:
Video: 320x240 (I've tried from 600kbps to 2000kbps)
Format: MPEG
Container: MPEG
Audio: LAME MP3 44.1khz Stereo CBR 128KBPS
And everytime I start playback I get the beginning skipping, slowing down almost to a stop, and then slowly going up to speed and playing normally.
I also encounter an error before the video loads of "Missing Packet Start Code Prefix: 00 at FF00"
Video
Mode: Bitrate-based 800kbps
Format: MPEG1
Container: MPEG1
Audio
Encoder: LAME MP3
Resample: 44100 Hz
Channel: Stereo
RateMode: CBR
Bitrate/Quality: 128 kbps
Everything else is set to auto.
The following features have been added:
() Removed the software limits on number of files to resume
() Added resume clear option from video playback menu
The following features have been added:
() Seek time is now done in half minutes
I can play all my old videos without re-encoding them. So great work!
Everything for the Gigabeat-F40 is working perfectly!
THANK YOU!
The lines (two of them) in mpeg_settings.c
draw_slider(preview_ypos+preview_height+20, play_time, resume_time);
references the display of the slider to the preview position. This dosen't work on players with very small screens (like my iPod nano). The screen height is 132, with a preview size of 90 this puts the top of the slider at 131 ypos (off the bottom of the screen). I have changed this to:
draw_slider(LCD_HEIGHT-29, play_time, resume_time);
Which puts the slider at the same position relative to the bottom screen all the time.
The second thing that I found is that if the video is encoded using B frames (which I do, as it can improve the fps) then the frame displayed in the preview is usually a B frame, and is mostly garbage.
I changed (in mpeglayer.c)
if (video_thumb_print)
video_str.status = STREAM_STOPPED;
to:
if (video_thumb_print && ((int)(info->current_picture->flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I))
video_str.status = STREAM_STOPPED;
so that the prieview display will only display an I frame. This does result in a slight (about .5 sec) delay while the next I frame is found, so I'm not sure if the delay for I frames vs the value in using B frames is really justified. It might be better not to use B frames at all, however if you don't use B frames, there is no delay, and everything works as previously - so it may be worth adding just from that point of view. One problem with this is that the play_time stored is the B frame (not the next I frame), so starting from there results in about 0.5 sec's of pixilation. I haven't figured out how to update play_time to store the I frame time yet, but it's not a big deal.
The seek time being 30 seconds is a great improvement, but I think that what you should really do is base the seek time on the playing time of the video, so if the video is say 5 mins long (music video) the seek time is shorter, say 15 seconds, and if the playing time of the video is longer (movie or something) the seek time is 30 seconds. I think I know how to do this, and I'll have a go at implementing it, but it's just a suggestion.
I'm currently doing tests with the iPod nano simulator to find a solution for preview on the small screen.
Tried your latest patch, and it works great (much better than my kludge). Thanks for looking at this so quickly. What do you think about the variable seek time idea?
this patch works great thanks for all the effort that has gone in. I just thought of a minor addition that might be useful: if the fwd and rwd buttons were mapped to the patch this would offer some form of fwd and rwd to the mpegplayer, probably already considered.....
Thanks again, Chris
scramble.o: In function `main':
/rockbox/tools/scramble.c:264: undefined reference to `_gigabeat_s_code'
gigabeats.o: In function `openinfile':
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:25: undefined reference to `fopen'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:28: undefined reference to `stderr'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:28: undefined reference to `fprintf'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:29: undefined reference to `perror'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:30: undefined reference to `exit'
gigabeats.o: In function `openoutfile':
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:37: undefined reference to `fopen'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:40: undefined reference to `stderr'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:40: undefined reference to `fprintf'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:41: undefined reference to `perror'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:42: undefined reference to `exit'
gigabeats.o: In function `gigabeat_s_code':
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:65: undefined reference to `fseek'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:66: undefined reference to `ftell'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:67: undefined reference to `fseek'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:68: undefined reference to `malloc'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:70: undefined reference to `stderr'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:70: undefined reference to `fwrite'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:73: undefined reference to `fread'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:84: undefined reference to `fwrite'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:85: undefined reference to `fwrite'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:95: undefined reference to `fwrite'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:103: undefined reference to `fwrite'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:104: undefined reference to `fwrite'
gigabeats.o:/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:111: more undefined references to `fwrite' follow
gigabeats.o: In function `gigabeat_s_code':
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:166: undefined reference to `stderr'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:166: undefined reference to `fwrite'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:168: undefined reference to `fclose'
/home/bmorey/Projects/rockbox/rockbox_svn_2007-09-21/tools/gigabeats.c:169: undefined reference to `fclose'
collect2: ld returned 1 exit status
make[1]: *** [scramble] Error 1
make: *** [tools] Error 2
Isn't the MPEG_SCROLL_DOWN and MPEG_SCROLL_UP the wrong way round in mpeg_settings.c? I see that MPEG_SCROLL_UP and MPEG_LEFT are the same action (in the case statement) and vice-versa in the MPEG_RIGHT case statement. On my iPod this means that you have to scroll down to fast forward through the video (had me very confused at first!).
I have fixed this in my copy, and now it works the way (I think) that it should. Previous versions didn't do this (they were the other way round) is this just a simple coding error? or to do with other targets (in which case the iPod button mapping should be changed).
Charles
In fact I tried to sync the patch myself after Mike Sevakis's dithering commit and got the same problems.
The following issues were fixed:
() iPod scroll direction was reversed
() video displaying green blocks
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
#define MPEG_SELECT BUTTON_PLAY
#define MPEG_RIGHT BUTTON_RIGHT
#define MPEG_LEFT BUTTON_LEFT
#define MPEG_SCROLL_DOWN BUTTON_SCROLL_UP
#define MPEG_SCROLL_UP BUTTON_SCROLL_DOWN
#define MPEG_EXIT BUTTON_POWER
with
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
#define MPEG_SELECT BUTTON_ON
#define MPEG_RIGHT BUTTON_RIGHT
#define MPEG_LEFT BUTTON_LEFT
#define MPEG_SCROLL_DOWN BUTTON_UP
#define MPEG_SCROLL_UP BUTTON_DOWN
#define MPEG_EXIT BUTTON_OFF
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
#define MPEG_SELECT BUTTON_PLAY
#define MPEG_RIGHT BUTTON_RIGHT
#define MPEG_LEFT BUTTON_LEFT
#define MPEG_SCROLL_DOWN BUTTON_UP
#define MPEG_SCROLL_UP BUTTON_DOWN
#define MPEG_EXIT BUTTON_POWER
The following issues were fixed:
() button mapping for the iriver player
The following features were added:
() support for the iaudio player
Note: If you find this patch useful please click on the vote link at the top of this thread. We put a lot of effort into this patch and this gives us some feedback that people like what we are doing.
But why it can't be commited to SVN?
But why it can't be commited to SVN?
But I don't have a problem with this patch, I like the features.
Skip forward:
Implementing that type of functionality for mpegplayer will most likely not be possible for many targets such as the Sansa e200. The reason being the relatively slow processor. We have spent a lot of time studying and testing ideas to do just that and have settled on what you find in the patch. To advance, say 30 seconds, into a stream you have basically one of two choices (that I know of).
(1) Decode, stay synchronous to the stream, not display/play the contents, and quickly move to the point of continuation. The quickly part is the problem. Just decoding the stream, again for the Sansa, is somewhere near 20 frames/sec. Skipping 30 seconds will take on the order of 20 seconds. Not very practical.
(2) Estimate and seek forward to the point in the stream that play would resume, re-synchronize the stream, test the PTS and correct the the stream seek position, once close re-synchronize the audio and video decoders, drop data until audio and video are synchronized. This is the approach used in our patch. On the Sansa with our algorithm this can take from 4-10 seconds based on the accuracy of the estimator. This is not practical for a forward skip button. If you want to skip forward say 5 minutes and the skip button only goes 30 seconds each push, that will take you 100 seconds to advance.
Surely, you must find the slider and preview more useful than something like that?
Fast forward:
Until the frame rate of decoding can be substantially increased, fast forward on targets like the Sansa will only be about 15% faster than normal play. Buffer filling and decoding just take too much CPU power.
Undoubtedly, targets with fast processor and future higher performance players will be able to implement a fast forward or skip function as suggested. But this patch, IMHO, is about the only means that slow targets have of watching videos.
So, if you feel that this patch is not a real “fix”, I will ask if you are naive of the issues? If you know of a better approaches, I would gladly like to hear them.
On a side note, the patch not only adds seeking/resume but it also includes several fixes to coding and implementation errors. The player straight out of svn will crash on average about 1 hour and 20 minutes into a movie. I have watched a number of movies with my Sansa now after patching and know of no problems. mpegplayer really needs some coding help. Developers, will you let us help you?
john
I just thought it's doable, because the e200 OF is also able to seek (diffenrent codec though).
The MJPEG codec is decoded in hardware (part of the PortalPlayer chip).
Charles
Same here, I manage to get it compiled, but I got a plugin error.
Charles
As for start time seeking from the player menu itself, that will be a challenge. We have talked about making that change for some time now, but every time we get around to it we have to spend the weekend fixing the patch due to recent commits.
It might be better to get the current version of the patch committed so that people making commits to SVN can't break the patch and then we can start a new thread adding seek from the play menu.
Anyway, updated patch should be posted as soon as it passes all of our tests.
Note: Thanks for the votes and feedback, it's nice to see people are using our work.
Sim seems to not return any errors, which is good.
Also with the 0.5 min steps, it is a little slow to seek through large files - maybe up/down could be mapped to 10min steps?
I also had a chat with linuxstb (original author) about the patch on irc (see http://www.rockbox.org/irc/reader.pl?date=20071001 from around 23.13) He recons that I should consult with jhMikeS who has plans to implement seeking, so I'll try to catch him.
Linuxstb also mentioned the hardcoded bitmap. Could you perhaps change it over to use the build system or alternatively leave it out completely? A rectangle would be sufficient and it isn't displayed anyway for x5.
Anyway. Thanks for getting it in sync again.
The following changes were made:
() added button mapping for Sansa C200
() Gigabeat and Sansa E200 now skip 10 min. seek on button up/down
() embedded bitmap removed
() code clean-up
The following changes were made:
() removed floats to follow Rockbox guidelines
() more code clean-up
If this feature is part of the patch already it is not working for me on my gigabeat build.
The following changes were made:
() removed floats from code
() better support for smaller players (ipod nano)
() more code clean-up
Since all of the other files in the patch are fine, I'll attach to patches - one with everything, and one of just mpegplayer.c