Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

play looping video #16

Open
efolger opened this issue Jul 4, 2012 · 89 comments
Open

play looping video #16

efolger opened this issue Jul 4, 2012 · 89 comments

Comments

@efolger
Copy link

efolger commented Jul 4, 2012

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.

@huceke
Copy link
Owner

huceke commented Jul 5, 2012

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

@efolger
Copy link
Author

efolger commented Jul 5, 2012

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
reply@reply.github.com
wrote:

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


Reply to this email directly or view it on GitHub:
#16 (comment)

@Pauly24
Copy link

Pauly24 commented Jul 19, 2012

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)

@efolger
Copy link
Author

efolger commented Jul 19, 2012

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 efolger closed this as completed Jul 19, 2012
@efolger efolger reopened this Jul 19, 2012
@Pauly24
Copy link

Pauly24 commented Jul 19, 2012

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.

@huceke
Copy link
Owner

huceke commented Jul 19, 2012

Patches welcome :D

@efolger
Copy link
Author

efolger commented Jul 19, 2012

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

@Pauly24
Copy link

Pauly24 commented Jul 19, 2012

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

@trickkiste
Copy link

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.

@pfee
Copy link

pfee commented Sep 10, 2012

+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.

@cscscheng
Copy link

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..

@pfee
Copy link

pfee commented Oct 24, 2012

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?

@kronick
Copy link

kronick commented Oct 26, 2012

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.

@torarin
Copy link
Contributor

torarin commented Oct 26, 2012

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.

@parasew
Copy link

parasew commented Nov 3, 2012

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?

@bendenoz
Copy link

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.

bendenoz@cd47dbb

@kronick
Copy link

kronick commented Feb 10, 2013

@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.

@efolger
Copy link
Author

efolger commented Feb 10, 2013

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

@bendenoz
Copy link

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 raspberrypi/firmware@bb97480) 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...

@efolger
Copy link
Author

efolger commented Feb 11, 2013

Thank you!

@exidyboy
Copy link

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

@popcornmix
Copy link
Collaborator

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.

@hinxx
Copy link

hinxx commented Feb 20, 2013

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).

@bendenoz
Copy link

@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...

@exidyboy
Copy link

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.

@Seelen
Copy link

Seelen commented Feb 25, 2013

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

@exidyboy
Copy link

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.

@gch99
Copy link

gch99 commented Feb 27, 2013

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 :-)

@xuv
Copy link

xuv commented May 27, 2013

Sorry if this is the wrong thread, but I have downloaded the latest binary from @pasky (02-Apr-2013) and It throws this error: error while loading shared libraries: libavcodec.so.54: cannot open shared object file: no such file or directory Any clue?

@shaybenavi
Copy link

Hi All
I got a nice solution for the delay between
I'm running a python code which waiting the movie length - 1 and than start another omxplayer process
it's working perfectly! with no delay between clips

@efolger
Copy link
Author

efolger commented Jun 2, 2013

shaybenavi - Sounds good, do you have a link to your python code?

@Seelen
Copy link

Seelen commented Jun 2, 2013

Hello shaybenavi,

You can share the python script to tetst it.

thanks,

On Sun, Jun 2, 2013 at 4:42 PM, shaybenavi notifications@github.com wrote:

Hi All
I got a nice solution for the delay between
I'm running a python code which waiting the movie length - 1 and than
start another omxplayer process
it's working perfectly! with no delay between clips


Reply to this email directly or view it on GitHubhttps://github.com//issues/16#issuecomment-18814523
.


 Julián Gutiérrez Palacio
       Grupo Nethexa

Ing. de Telecomunicaciones

@shaybenavi
Copy link

import time, subprocess

def PlayList(Movies):
_________for movie in Movies:
__________________p = subprocess.Popen(["omxplayer", movie[0]])
__________________time.sleep(movie[1])
_________PlayList(Movies)

#Movies list here name and length
Movies = [['1.mpg',20],['2.mpg',10],['3.mpg',15]]
Playlist(Movies)

@eins78
Copy link

eins78 commented Jun 3, 2013

I tried to read the whole thread, but I haven't seen any reasons why the looping patch can't be merged. What needs to be done?

@davidcool
Copy link

@shaybenavi
I don't have any Python experience so could be something simple I'm missing, but I got this error when I tried to execute it:

Traceback (most recent call last):
File "./python_loop.py", line 15, in
Playlist(Movies)
NameError: name 'Playlist' is not defined

Any ideas?

@Wollno
Copy link

Wollno commented Jun 17, 2013

@davidcool Python is case sensitive. Playlist should be PlayList. Small mistake

I can confirm this python method works "basically" though unfortunately the load times of each clip varies, stopping pure seamless play. However it enables you to have 2 instances of OMXplayer running over the top of each other. With tweaking you could hack together a basic loop

@scollins15
Copy link

I have tried to compiled Pasky's version and am having errors with make ffmpeg. I am cross compiling on a Ubuntu machine. The error I am getting is, that when executing the $(HOST)-strip ffmpeg_compiled/usr/local/lib/*.so, I get the error no such file found. Although the files do exist under that directory. Any one with suggestions? I would greatly appreciate it.

Or a step by step guide to compiling the Pasky version of the OMXplayer, would be great as well. I am willing to run whatever OS setup I need to, to accomplish this. Thanks in advance.

@scollins15
Copy link

Ok I have managed to get make ffmpeg to complete when trying to cross compile on a Ubuntu machine, the error I was missing above, was a forward slash in the file name, so obvious I overlooked. Now I am unable to run make. I get an error command not found. I would love to be able to compile @pasky's version.
Is anybody having this issue and know how to get this version to compile completely. Thanks.

@paolovacirca
Copy link

What is the reason to why the --loop isn't part of the official omxplayer repository?

PS: It works great!

@stewiem2000
Copy link

@MrOaiki: There appear to be a large number of forks of omxplayer at various different stages and with numerous different features/changes, I imagine it is an incredibly non-trival task to fold-in pull-requests -- I certainly found trying to port some of the changes needed unfathomable :(

Anyway, assuming that popcornmix's version is the new "official" repo, I've had a go (from scratch) at implementing seamless looping of the current-file in a branch here: https://github.com/stewiem2000/omxplayer/tree/seamless-looping

Hope it helps somebody.

@paolovacirca
Copy link

@stewiem2000 : When you say "current file", I guess you mean that only one file can be looped, not a whole folder of files? Is that due to the fact that Pasky brings up, that Omxplayer has to be fed with a continuous stream of files with the same resolution and bitrate?

@pasky Since I updated my Rasberry Pi, your fork of Omxplayer freezes on the last frame after a loop or two. Do you happen to know why or perhaps have a clue?

@timonsku
Copy link

Is there still going work into this? Most of the repos seems to be "dead" for a year now or longer. I'm very much interested in seamless video switching, especially on command by lets say a gpio input. Has anyone tried that yet? Seems like the work was focused on "simple" playlist looping.

@stewiem2000
Copy link

@PTS93: I believe the development mantel has been picked up by @popcornmix (https://github.com/popcornmix/omxplayer)

@stewiem2000
Copy link

@MrOaiki: Correct, my needs when I wrote the patch were just to loop a single video indefinitely and seemlessly. And yes, in theory, if all the files use exactly the same formats/codecs/codec-parameters, it should be possible to pump the file-data into the pipeline without having to reset the OMX-subsystem (which is what causes the gaps).

@kornerb
Copy link

kornerb commented Jan 2, 2014

Hi, I cloned the stewiem2000/omxplayer and compiled via the instructions, but I don' t have the --loop switch in my help file, and --loop is an unrecognized option. I am somewhat new to linux, and I am using a Raspberry Pi. Any idea what I might have done wrong?

@timonsku
Copy link

timonsku commented Jan 2, 2014

Make sure you are executing the compiled binary and not the one you probably have installed on your system. You will execute the installed version if you do "omxplayer --loop" use "./omxplayer" instead. So you specify to use the version in the current folder. Or supply the full path to the binary.

@kornerb
Copy link

kornerb commented Jan 2, 2014

OK, thanks. If I compile in Pi natively, is the 'make dist' step still needed? because I tried that and it keeps erroring

@hsenot
Copy link

hsenot commented Jan 22, 2014

@kornerb I followed the entire set of instructions from @stewiem2000 (including make dist and cp -R omxplayer-dist/* /) on his seamless-looping branch and it works beautifully - looping right now! Took me a couple of shots (i.e. about a day to get it to compile) as I encountered a number of issues, all of them have solutions in various threads, summarised below:

sudo apt-get install libdbus-1-dev
  • add dbus entries at the end of CFLAGS line:
-I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include

Good luck

@paolovacirca
Copy link

Does this enable seamless looping of several clips in a folder, or just one file?

22 jan 2014 kl. 23:38 skrev Herve Senot notifications@github.com:

@kornerb I followed the entire set of instructions from @stewiem2000 (including make dist and cp -R omxplayer-dist/* /) on his seamless-looping branch and it works beautifully - looping right now! Took me a couple of shots (i.e. about a day to get it to compile) as I encountered a number of issues, all of them have solutions in various threads, summarised below:

CFLAGS stuff: #156
gcc version: #157
dbus stuff: sudo apt-get install libdbus-1-dev
add dbus entries at the end of CFLAGS line: -I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include
Good luck


Reply to this email directly or view it on GitHub.

@kornerb
Copy link

kornerb commented Jan 23, 2014

thanks @hsenot I was actually able to get my hands on a binary someone had already compiled. But I will keep this in mind.

@ieq-lab
Copy link

ieq-lab commented Feb 2, 2014

Hey @hsenot or @kornerb any chance of sharing the binary? I've tried to compile it but it keeps throwing out errors. Thanks.

@AndyA
Copy link

AndyA commented Apr 3, 2014

You can, if necessary, re-wrap your video as an MPEG transport stream like this:

ffmpeg -i <video.mp4> -bsf -bsf h264_mp4toannexb -c copy <video.ts>

And then, assuming you have all the videos in a directory called "loop" play them in a continuous seamless loop like this:

omxplayer <( while true; do find loop -name '*.ts' -print0 | xargs -0 cat; done )

That relies on the fact that MPEG transport streams can be concatenated. The loop inside the brackets keeps finding all the *.ts files and outputting their contents. The shell redirection <( ... ) causes that looped output to be fed into OMX player.

Any files that are added to the directory will the player is running will be discovered the next time round the loop.

@rizo
Copy link

rizo commented May 30, 2014

Thank you @AndyA, it does work! But there's something really strange happening!

The second time the video is played in an accelerated mode, twice as fast as normal, I think.
I reduced the code to omxplayer <( cat <video.ts> <video.ts> ) and it still plays the second part faster the it should. Do you know what may be the reason? Thanks.

@rizo
Copy link

rizo commented May 30, 2014

I forgot to mention that during the encoding to ts, ffmpeg printed a warning:

[adts @ 0x7faf41009800] Encoder did not produce proper pts, making some up.

@mvasin
Copy link

mvasin commented Sep 19, 2016

Did somebody manage to play multiple different .mp4 videos in a row without gaps on Raspberry PI? By any means?

By playing multiple videos one by one I mean a script like

`omxplayer video1.mp4`
`omxplayer video2.mp4`
`omxplayer video3.mp4`
...

I know there is hello_video option, but it still has 0,1s gap and videos must be recoded to "raw h264" – it doesn't fit me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests