omxplayer icon indicating copy to clipboard operation
omxplayer copied to clipboard

play looping video

Open efolger opened this issue 12 years ago • 89 comments

I would like to see a command line option to allow constant looping of a video or list of video files. I am making a player for video installations at art galleries and this feature is essential.

efolger avatar Jul 04 '12 20:07 efolger

What about wrapping the player call into a ordinary shell script ?

huceke avatar Jul 05 '12 08:07 huceke

Yeah, I thought of that, but I want to make the looping play as seamless as possible, the last frame of video is matched to the first ... it should look continuous ... I'll play with it when I have a chance next week. Thanks.

On Thu, Jul 5, 2012 at 4:57 AM, huceke [email protected] wrote:

What about wrapping the player call into a ordinary shell script ?


Reply to this email directly or view it on GitHub: https://github.com/huceke/omxplayer/issues/16#issuecomment-6774116

efolger avatar Jul 05 '12 12:07 efolger

I need the exact same requirement, I have already put omxplayer into a loop inside my code but the 3 second wait makes it a bit nasty especially when the video files are relatively short (<10sec)

Pauly24 avatar Jul 19 '12 10:07 Pauly24

We need a flag to continue buffering the file from the beginning when it comes to the EOF. That would make the rasp pi a killer for video art applications. I used to do some C programming, but I don't have much time these days. Maybe I'll have a look at it, if no one else can do a quick fix.

efolger avatar Jul 19 '12 13:07 efolger

I think when omxplayer is called another option can be set for a playlist, this way when the EOF is reached it can start buffering from the next file in the playlist. Not only will this make it seamless looping but also it will implement a playlist function. Two birds with one stone.

Pauly24 avatar Jul 19 '12 14:07 Pauly24

Patches welcome :D

huceke avatar Jul 19 '12 14:07 huceke

Two birds with five stones if you are doing the coding ;)

efolger avatar Jul 19 '12 14:07 efolger

I'm going to have a look, but my C is very limited so not sure how much help I will be.

Pauly24 avatar Jul 19 '12 14:07 Pauly24

Would love to see this implemented as well! Gap-less Playback of the playlist would be a killer feature. Non of the "standard" video players does this right! And eventhough gstreamer has a facility for this, this thing is broken all the time.

trickkiste avatar Jul 26 '12 11:07 trickkiste

+1 for gapless looping over a video.

I'll try experimenting with OMXPlayerVideo::close(), OMXPlayerVideo::open() or perhaps feeding an endless sequence of packets into it via OMXPlayerVideo::AddPacket().

I don't need audio for my application, so I'm going to ignore m_player_audio for now.

Have any of the folks above made any progress implementing looping? I am able to get video loops with XBMC, but the delay when restarting the video is too much for my needs.

pfee avatar Sep 10 '12 22:09 pfee

if you split a file to some part it will work ...

but some diffrent file when you do OMXPlayerVideo::close(), OMXPlayerVideo::open() the sceen will show black..

cscscheng avatar Oct 24 '12 02:10 cscscheng

Are there instructions on setting up the build environment for omxplayer? The source code looked reasonable, but I haven't got a build environment setup to permit experimentation. Is it best to build on a Raspberry Pi or is there a convenient way to build on Linux/x86_64 platforms?

pfee avatar Oct 24 '12 21:10 pfee

I'm trying to tackle this same issue-- I have some ideas from looking at the source code but getting a dev environment set up is a challenge as @pfee mentioned. Any suggestions on the fastest path to getting going? I would love to start contributing.

kronick avatar Oct 26 '12 19:10 kronick

It is quite convenient to cross-compile using https://github.com/raspberrypi/tools. You can mount the Pi filesystem on your build machine and then use the header files and libraries installed on it when building. If you tell me where you hit an obstacle, I'll try to help.

torarin avatar Oct 26 '12 19:10 torarin

wrightrocket has a fork that builds on the pi. see https://github.com/wrightrocket/omxplayer why can't we merge the changes so this repo code actually builds on the pi as well?

parasew avatar Nov 03 '12 10:11 parasew

I have been experimenting with this and have a working version (at least for my purpose) Definitely a hack because of the not very clean "UnFlush" method but feel free to test / pull.

https://github.com/bendenoz/omxplayer/commit/cd47dbb47cfa1a2ef2d5a8ca3f80e1348a76fa49

bendenoz avatar Jan 30 '13 14:01 bendenoz

@bendenoz Could you share the binary? I still haven't had success setting up a build environment and this is the main feature I need.

kronick avatar Feb 10 '13 01:02 kronick

I'm with kronick - love to see a binary. I opened this issue and haven't had time to go anywhere with it.

efolger avatar Feb 10 '13 01:02 efolger

Don't really have a good place to keep it, but it's here for now: http://s3.phileog.com/.../omxplayer-dist.cd47dbb.tgz (probably only temporarily...) Note that it's been build against a recent firmware (at least this one https://github.com/raspberrypi/firmware/commit/bb97480b961370956fa2a4300dc1ea6a7f519141) so you'll likely have to update your boot files as well as the /opt/vc directory (the one from the hardfp directory) Let me know...

bendenoz avatar Feb 11 '13 22:02 bendenoz

Thank you!

efolger avatar Feb 11 '13 22:02 efolger

Thanks bendenoz. I downloaded your binary and after learning a lot of Linux 101 stuff I watched my 20 minute documentary loop for an hour or so but it was not still running in the morning. That could be due to any number of problems at my end although the Pi was still responsive to the command line. Has anyone tested over an extended duration (days).

Is there somewhere I can look on the Pi for evidence of any issue or some environment I can set up to monitor the process ?

Thanks again for this exciting and valuable contribution.

Michael

exidyboy avatar Feb 15 '13 22:02 exidyboy

Probably a resource leak. Does omxplayer exit? Is so, then it might be a memory leak on arm side (you may have an oom killer message in dmesg log). If omxplayer is still running but hung, then it's probably not destroying an openmax component, and eventually gpu runs out of memory.

popcornmix avatar Feb 18 '13 16:02 popcornmix

You can see how much memory is left by issuing "free" command. Also the output of "top" can be useful. There also numerous other sources of memory consumption. For starter you can periodically issue "free" during the night and save the output for later analysis. I believe that memory consumption can be be seen per process, too (IMHO, even "top" can do that).

hinxx avatar Feb 20 '13 10:02 hinxx

@exidyboy what is your content and did you actually get any error message from the player? I've had it run for almost 24h and could not measure any increase in memory usage, but again haven't done very extensive testing...

bendenoz avatar Feb 22 '13 12:02 bendenoz

I set 'free' up to poll every 60 seconds and have been running pi@raspberrypi ~ $ omx/omxplayer-dist/usr/bin/omxplayer.bin --loop Desktop/high.m4v for the past four days - there is no memory leak. I think the 'issue' was that I was running omxplayer.bin via ssh from a terminal window on my PowerBook and when it went to sleep at night omxplayer would exit. Sorry for wasting your time.

exidyboy avatar Feb 22 '13 20:02 exidyboy

@exidyboy Please tell me if you can solve the black time between the videos, I need the same loop solution

Seelen avatar Feb 25 '13 17:02 Seelen

Hi Seelen,

I am not the author of this hack to get omxplayer to loop a clip. The author is bendenoz who pops into github from time-to-time. I'm just passionate about the use of the Pi in artistic and cultural institution installations and am doing what I can to facilitate progress against this use case - and looping is one of a number of important functional requirements for these users.

However after some testing tonight I don't get any 'black time' between 'videos'. I assume you mean frames of black appearing between the end of a video and the re-starting of the video (singular) - but nor do I get the completely seamless looping over the end-of-file/start-of-file boundary that I suspect you are looking for and that is really necessary if looping is to ultimately become a meaningful in-built feature of omxplayer as opposed to accomplishing non-seamless repeat play of a clip via an out-of-band script. As bendenoz freely admits this is not yet a fully resolved solution. If you would care to post a clip somewhere I would be happy to test it.

exidyboy avatar Feb 27 '13 14:02 exidyboy

Much thanks to bendenoz. Running it now, way better than looping in script. Agree with kronick, would like to get a development environment set up. Never done it before either, would like the dummies guide :-)

gch99 avatar Feb 27 '13 17:02 gch99

@exidyboy thanks for confirming about the memory issue, and yes sorry for the sporadic replies... What kind of issues are you still seeing with the looping? I'd probably recommend making sure the content starts and ends with a few frames of still images for it to be really seamless...

@gch99, I'm not an expert but I found the easiest was to start from a fresh Ubuntu install so you can easily install all the dependencies (you can use a virtual machine), and follow the instructions on eLinux.org to setup the cross-compiling environment. Be prepared to tweak the Makefiles though...

/Ben

bendenoz avatar Feb 28 '13 09:02 bendenoz

Question, what is the difference between omxplayer and omxplayer.bin? To get the omxplayer.bin to work ( the one installed and the one from @bendenoz), I had to create a lot of symbolic links in the /usr/lib dir for the libraries in /usr/lib/omxplayer. Where as the omxplayer just worked without any changes. About the looping ... For seamless operation the content should begin and end with the exact same frame, one frame only. The program should not pause or hesitate at all. Thus should try and buffer the 1st few frames so that playout from end back to beginning would be like there is never an end.

gch99 avatar Feb 28 '13 14:02 gch99