huceke / omxplayer

omxplayer
GNU General Public License v2.0
521 stars 501 forks source link

play looping video #16

Open efolger opened 12 years ago

efolger commented 12 years ago

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.

ghost commented 11 years ago

Just tried the binaries from @pasky and it opens 2 threads for both videos I am putting in as an argument. However, the first video stops with the last frame but it's not showing the second video.

Any clues on what might be the problem?

hinxx commented 11 years ago

@gch99

IMHO, you are missing the ARM (hf) architecture boost stuff.

You are showing the i686 architecture release (your PC). Usually (depends on the Linux disto) you do not install the cross compiling stuff using your systems native packager. You would either need to find armhf compatible libraries in a specific repository or simply recompile them on your own. Another approach is to use files found on the official raspbian image and feed them to you cross compiler.

I think I've avoided cross compiling omxplayer on my PC 'cause of the numerous dependencies for packages I would need to provide, one of them being boost. Compiling on the PI itself is more straight forward, but slooooow as ..

jasonaeguana commented 11 years ago

Hi everyone,

We're working on a commercial application for the Raspberry Pi running OMXPlayer requiring playlist / loop functionality. It sounds like no one is quite there yet, so we're looking to get a team together to help us achieve this. We're based in London, UK so if anyone is around who wants to tackle this together just let me know. We're happy to pay for someones time of course, and release the end-result to the community :)

pasky commented 11 years ago

On Tue, Mar 26, 2013 at 12:43:43PM -0700, marpfa wrote:

Just tried the binaries from @pasky and it opens 2 threads for both videos I am putting in as an argument. However, the first video stops with the last frame but it's not showing the second video.

Any clues on what might be the problem?

I have fixed a race condition that might have been causing this. I have updated both the Git repo and the binaries, can you please try it out again?

TitustheFox commented 11 years ago

Hey Pasky, any news from from the updates ? Last time you posted "Please note that this branch does not include the latest updates by @bendenoz (a little over a week old) so it might have some extra issues with playback, maybe. I'm waiting for some sort of feedback from omxplayer maintainer to my pull request before I will update my branch again."

I would love to know if there exists some new stuff ...

Thanks

cheers fox

pasky commented 11 years ago

Hi! I still haven't received any feedback from the omxplayer maintainers regarding my pull request. You are welcome to try to merge the master into my branch yourself.

TitustheFox commented 11 years ago

Halo Halo pasky, thanks for answering, BUT... what do you mean with this??? is that quote based on my plan (above in the forum), to construct a sync player or do you want a tag team ;-)

regards fox

kronick commented 11 years ago

Hey @TitustheFox I'm interested in working on a branch that allows synchronized playback via the network or even GPIO. I just installed a show this week with 3 players happily doing 1080p looping video and they seem to stay in sync for a couple of hours before getting thrown off. Keep me informed if you make or hear about any progress on this. I can do c/c++ programming but it will take me a while to get up to speed on the video hardware-specific stuff going on here.

pasky commented 11 years ago

@TitustheFox, I'm sorry, I don't follow right now. I don't know about your plans, I didn't read the forum. Synchronization between players would be perfectly possible but not something I can work on in my free time.

(Also note that if you want any extra updates, I'm a freelance programmer and I would be happy to help you on a commercial basis if you cannot wait. I hope this note won't offend anyone. :-)

ghost commented 11 years ago

Hi @pasky,

thanks for the updated code. The binary works great, multiple files as well as looping them. There's approximately 0.5s freeze between the videos. Haven't found the time to build it from source, but that's still to come.

pasky commented 11 years ago

Yes, that freeze is unfortunately what I don't know how to avoid. Based on my findings, this is just the time required to update the OMX subsystem state and everything from there down is closedsource. There might be some tricks to avoid even this delay, but IMHO that would require some reverse engineering of the Broadcom libraries (or at least someone much more familiar with the OMX API than me).

Hopefully, this is still enough for some applications, especially with videos that have fadeout/fadein.

groby commented 11 years ago

Merged benendoz patch against HEAD: https://github.com/groby/omxplayer/commit/7ff5b73263295a076986624f627a0bc741ad10f3

Sure wouldn't mind if the pull request happened, though ;)

(Caveat: I have done this very roughshod - there might be issues, since there were merge conflicts. There's an artshow in less than 2 days, so no time to be pretty :)

Next up, watchdog support - unless somebody has a patch for that already?

xuv commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

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

Seelen commented 11 years ago

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/huceke/omxplayer/issues/16#issuecomment-18814523 .


 Julián Gutiérrez Palacio
       Grupo Nethexa

Ing. de Telecomunicaciones

shaybenavi commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

@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 commented 11 years ago

@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 commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

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

PS: It works great!

stewiem2000 commented 10 years ago

@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 commented 10 years ago

@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 commented 10 years ago

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 commented 10 years ago

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

stewiem2000 commented 10 years ago

@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 commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

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

hsenot commented 10 years ago

@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
-I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include

Good luck

paolovacirca commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

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

AndyA commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

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 commented 8 years ago

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.