antonius
Posts: 7
Joined: Wed Oct 28, 2015 8:12 pm

Seek and pause in hello_video

Wed Oct 28, 2015 8:34 pm

Hello!

Please, I have two questions about playing accelerated video on RPi. I was thinking that the simplest way would be to modify the player included in "hello_video" [1]. Btw., my video is without sound.

1. Is it possible to "seek" (i.e. to jump or skip) to certain time/frame in the video? Say I would like to play first 3 seconds of the video, jump to 10th second and continue playing from there.

2. Is it possible to pause the video? For example, I would like to display the first frame for 10 seconds, after which the video would start to play.

I don't really mind whether it is done using "hello_video", it's just I could not find any suitable player: omxplayer apparently cannot seek but perhaps there are other options?

I also found the post about seamless looping [2] but I don't understand how I could utilize it for the two problems above: it seems to read the video file to feed the decoder buffers and when it is at the end of file it starts from the beginning again. However, if I were to stop the video I cannot simply stop feeding the buffers, right? And I cannot simply fseek into the file because I don't know where to seek to because h264 frames are compressed.

Thank you very much in advance!

[1] https://github.com/raspberrypi/firmware ... eo/video.c
[2] viewtopic.php?p=103421#p103421

dickon
Posts: 233
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: Seek and pause in hello_video

Wed Oct 28, 2015 9:33 pm

omxplayer certainly can seek, assuming your container has the appropriate index points. If you remux your video (with ffmpeg or the like) into an mkv or mp4, it'll probably just work.

antonius
Posts: 7
Joined: Wed Oct 28, 2015 8:12 pm

Re: Seek and pause in hello_video

Wed Oct 28, 2015 9:45 pm

What is an "index point"? Does it have something to do with "chapters" [1] so I could jump back and forth and then play?

[1] http://elinux.org/Omxplayer#Hotkeys

dickon
Posts: 233
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: Seek and pause in hello_video

Wed Oct 28, 2015 10:14 pm

As you've noted, frames are variable sized things, and as such, seeking directly to any given frame is impossible. If your video is put into a container which supports an index of where the I-frames are -- and that's more or less all of them, excepting specialist containers like transport streams[0] -- seeking becomes possible. The downside is that you then need a demuxer to read frames from the file, and that means ffmpeg and libav with all the fun and games that implies.


[0] You can seek in a transport stream, but you basically just guess how far and search for the start of the next I-frame.

antonius
Posts: 7
Joined: Wed Oct 28, 2015 8:12 pm

Re: Seek and pause in hello_video

Wed Oct 28, 2015 10:58 pm

I apologize but I'm a bit confused now: you said that omxplayer can seek but I would need to use special container format which supports those "index points". Ok. But in addition to omxplayer I would also need ffmpeg et al.? I thought that omxplayer can handle it by itself..?

What I then thought you were saying is that a raw video content (as required by hello_video) can be put insider a container which support "chapters" (as in DVD players' chapters, where you can skip to some part of the movie) and I would use "i" and "o" hotkeys of omxplayer to jump between those?

All in all, thank you very much for the replies! I would still be a bit more happy if it was possible to use hello_video but I will definitely keep this as an option.

PS: Or you meant that I use ffmpeg to prepare the right containter type and first then use just omxplayer?

PPS: I trying to find any information about this "index point" but so far the searches turned nothing really. Do you perhaps have a link with some information about it?

dickon
Posts: 233
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: Seek and pause in hello_video

Thu Oct 29, 2015 12:53 am

omxplayer uses libav to do its demuxing (I believe); if you can get your content into a form that omxplayer can seek in it, you're probably sorted. Whether you need to define chapter points or not I don't know; the arrow keys in omxplayer should skip a defined period and don't require chaptering. Chapters are relatively coarse-grained: a full feature film probably won't have more than a few handfuls; the full index of seekable points will be a lot, lot bigger, and of the order of one every few seconds.

Your questions are coming across as a little naive: have you done anything with AV before (beyond simply playing stuff on a computer)? It's an irritatingly involved subject you need to know some fundamentals of before you can dive in writing software.

Return to “OpenMAX”