popcornmix / omxplayer

omxplayer
GNU General Public License v2.0
1.01k stars 334 forks source link

Pause function "evil" implemented with continuous flow #360

Open romuald-maillet opened 9 years ago

romuald-maillet commented 9 years ago

I am french my English is a translation of google . Original text below.

When omxplayer is paused, the image is frozen and nothing happens . Except that continues omxplayer has buffered the flow that arrives. Normal you tell me .

When the buffer is full , disaster.

To resume playback , omxplayer play its buffer and then leave !

Is this normal?

For a break acts like a real break (not reading a single file) . There must be a substantial amount of hard drive , right?

Is it would be hard to change implementtion this buffer to be stored on a file system (in ram with a ram disk or hard drive in my case) ?

A pause lasting , lasting , lasting . in short, a true break. ;-)

Soon, good day.

Fonction Pause "mal" implementé avec Flux continue

Je suis francais mon anglais est une traduction de google. Texte original ci-dessous.

Quand omxplayer est en pause, l'image est figé et rien ne se passe. Sauf qu' omxplayer continue a bufferisé le flux qui arrive. Normal me diriez vous.

Quand le buffer est plein, catastrophe.

A la reprise de lecture, omxplayer jouera son buffer puis quittera !

Est ce normal ?

Pour qu'une pause se comporte comme une vraie pause (non lecture de simple fichier). Il faut prévoir une quantité conséquente de disque dur, non ?

Est ce que ce serait dur de changer l'implementtion de ce buffer pour qu'il soit stocké sur un systeme de fichier (en ram avec un ram disque, ou sur disque dur dans mon cas ) ?

Une pause qui dure, qui dure , qui dure. bref une vrai pause. ;-)

A bientôt, bonne journée.

popcornmix commented 9 years ago

Are you saying after pausing in omxplayer for a while, then unpausing, that it plays for a few seconds and then exits? No that is not normal behaviour.

Where are you playing the file from (local storage, network storage or internet)?

If a network is involved it is possible a long enough pause may cause the server to close the socket, which will cause omxplayer to exit when buffered data has played out.

romuald-maillet commented 9 years ago

Yes it is AC you understood. I read a UDP stream from the network . I paused I do not want the socket closes. I want stored on hard disk data. A solution for a real break in this case?

Thank you for responding so quickly. I pause (lol) I have to go make a run I 'll be back in 30 minutes.

Oui c'est ca vous avez compris. Je lit un flux UDP depuis le reseau. Je suis en pause je veux pas que le socket se ferme. Je veux stocké les données sur disque dur . Une solution pour avoir une vraie pause dans ce cas ?

Merci de m'avoir répondu si vite. Je fais une pause (lol) Je dois partir faire une course je reviens dans 30 minutes.

romuald-maillet commented 9 years ago

re

romuald-maillet commented 9 years ago

Is it would be hard to change implementtion this buffer to be stored on a file system (in ram with a ram disk or hard drive in my case) ?

romuald-maillet commented 9 years ago

I am a developer I can try to develop a real break aurrai But I need your lights to find out how. I begin with ffmpeg and omxplayer .

Je suis developpeur je en peux essayer de developper une vraie pause Mais j'aurrai besoin de vos lumieres pour savoir comment m'y prendre. Je débute avec ffmpeg et omxplayer.

popcornmix commented 9 years ago

No support for pausing live streams with omxplayer. There is no mechanism to write streamed data to disk.

expandables2 commented 9 years ago

Install livestreamer http://livestreamer.tanuki.se/install.html

Then do this livestreamer 'Your udp link' best --player-continuous-http --player omxplayer --fifo With this opotion the stream will not exit until you tell it to. If you want to store the stream data on the disk then you will need rtmpdump

romuald-maillet commented 9 years ago

Thank you for this information.

The livestreamer package does not exist on RASPIAN Machine raspberry pi 2 .

For the rest there are two problems (which are linked)..

1) The fact qu'omxplayer leaves when paused and the buffer is filled .

2) The fact that the buffer is too small to have a break worthy of the name .

For the first problem . Would it be possible to resume play automatically before reaching the end of the buffer ( eg 10 seconds before the end ) . So the first problem would be resolved. A gender option : securisePause

For the second problem . I began to analyze the code. In the main loop, omxpacket is sent either to the object m_player_video , m_player_audio or m_player_subtitles .

If I serialize this frame in a FIFO and a thread Deserializes this frame to send to the objects , the approach is it possible ( regardless of the weight of evidence) ?

Merci pour ces informations .

Le paquet livestreamer n'existe pas sur RASPIAN machine raspberry pi 2.

Pour la pause il y a deux problemes (qui sont liés).

1) Le fait qu'omxplayer quitte lorsqu'il est en pause et que le buffer est remplit.

2) Le fait que le buffer est trop petit pour avoir une pause digne de ce nom.

Pour le premier probleme. Serait-il possible de reprendre la lecture automatiquement avant d'atteindre la fin du buffer (exemple 10 secondes avant la fin). Ainsi ce premier probleme serait régler. Une option genre : securisePause

Pour le second probleme. J'ai commencé a analyser le code. Dans la boucle principal, un omxpacket est envoyé soit a l'objet m_player_video, m_player_audio ou m_player_subtitles.

Si je serialise cette trame dans une fifo et qu'un thread déserialise cette trame pour l'envoyer aux objets, l'approche est elle envisageable (Indépendamment du poids des données) ?

romuald-maillet commented 9 years ago

For information LiveStreamer

pi@raspberrypi ~ $ git clone git://github.com/chrippa/livestreamer.git Cloning into 'livestreamer'... remote: Counting objects: 8012, done. remote: Total 8012 (delta 0), reused 0 (delta 0), pack-reused 8012 Receiving objects: 100% (8012/8012), 3.44 MiB | 1.88 MiB/s, done. Resolving deltas: 100% (4461/4461), done. pi@raspberrypi ~ $ cd livestreamer/ pi@raspberrypi ~/livestreamer $ python setup.py install Traceback (most recent call last): File "setup.py", line 5, in from setuptools import setup ImportError: No module named setuptools pi@raspberrypi ~/livestreamer $ sudo python setup.py install Traceback (most recent call last): File "setup.py", line 5, in from setuptools import setup ImportError: No module named setuptools pi@raspberrypi ~/livestreamer $

expandables2 commented 9 years ago

You install the dependencies? Looks like setup tools is not install wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python

romuald-maillet commented 9 years ago

thank you a lot I succeeded compilation. I look at the result and return you give the news.

Merci beaucoup. J'ai réussit la compilation. Je regarde le resultat et reviendrai vous donnez des nouvelles.

romuald-maillet commented 9 years ago

It Seems That livestreamer does not read the UDP stream flows compared to OMXplayer omxplayer -I udp://239.192.0.3:12345 .... Input #0, mpegts, from 'udp://239.192.0.3:12345': Duration: N/A, start: 77547.054844, bitrate: N/A Program 6 Stream #0:0[0x251]: Video: mpeg2video ([2][0][0][0] / 0x0002), none(tv), 25 fps, 25 tbr, 90k tbn, 90k tbc Stream #0:10x252: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s Stream #0:20x253: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s Stream #0:30x254: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired) Stream #0:4[0x255]: Unknown: none ([5][0][0][0] / 0x0005) Stream #0:5[0x256]: Unknown: none ([11][0][0][0] / 0x000B)

With livestreamer

pi@raspberrypi ~ $ livestreamer -O udp://239.192.0.1:12345 best error: No plugin can handle URL: udp://239.192.0.1:12345 pi@raspberrypi ~ $ livestreamer --plugins Loaded plugins: afreeca, afreecatv, aftonbladet, alieztv, ard_live, ard_mediathek, artetv, azubutv, bambuser, beam, beattv, bliptv, chaturbate, connectcast, crunchyroll, cybergame, dailymotion, disney_de, dmcloud, dmcloud_embed, dommune, douyutv, drdk, euronews, expressen, filmon, filmon_us, furstream, gaminglive, gomexp, goodgame, hitbox, itvplayer, letontv, livecodingtv, livestation, livestream, media_ccc_de, meerkat, mips, mlgtv, nhkworld, nos, npo, nrk, oldlivestream, periscope, picarto, rtve, ruv, sbsdiscovery, seemeplay, speedrunslive, ssh101, stream, streamingvideoprovider, streamlive, streamupcom, svtplay, tga, tv3cat, tv4play, tvcatchup, tvplayer, twitch, ustreamtv, vaughnlive, veetle, vgtv, viagame, viasat, viasat_embed, wattv, weeb, youtube, zdf_mediathek

Is there a plug-in for udp ?

expandables2 commented 9 years ago

livestreamer 'httpstream://' best --player-http

romuald-maillet commented 9 years ago

Yes i read the documentation and i try all but nothing result.

Adobe HTTP Dynamic Streaming hds:// Akamai HD Adaptive Streaming akamaihd:// Apple HTTP Live Streaming hls:// hlsvariant:// Real Time Messaging Protocol rtmp:// rtmpe:// rtmps:// rtmpt:// rtmpte:// Progressive HTTP, HTTPS, etc httpstream://

romuald-maillet commented 9 years ago

Hi everybody

For storage of the stream I'll see that later.

By cons, for the pause function that asks me a real problem when it lasts very long. Indeed OMXPlayer leaves when the buffer is full or rather when FFMpeg closes the socket .

I will wish a gender option AutoOffPause ( or other name ) when the data meets x % (90% default) buffer to avoid leaves qu'omxplayer when there resumed playing the stream (play) .

I think it is possible to implement it in the main loop of the hand in a few lines of code right?

Pseudo code : If pause and x % of the buffer is filled -> setPause (false);

With the setPause KeyConfig code :: ACTION_PAUSE :

Can help me write the function

boolean isFilledAt (int value) Returns true if the buffer is filled a percentage value .

Thank you to all.

Salut tout le monde

Pour le stockage du flux je verrai cela plus tard .

Par contre, pour la fonction Pause cela me pose un vrai problème quand elle dure tres longtemps. En effet OMXPlayer quitte quand le buffer est plein ou plutot quand FFMpeg ferme le socket.

je souhaiterai une option genre AutoOffPause (ou un autre nom) quand les données remplissent x% (90% par défaut) du buffer afin d'éviter qu'omxplayer quitte quand il y a reprise de lecture du flux (play).

Je pense qu'il est possible de l'implémenter dans la boucle principal du main en quelques lignes de code non ?

Pseudo code : Si en pause et x% du buffer est remplit -> setPause(false);

Avec setPause le code de KeyConfig::ACTION_PAUSE:

Pouvez m'aider a écrire la fonction

boolean isFilledAt(int valeur) Retourne vrai si le buffer est remplit a valeur pourcent.

Merci a tous.

romuald-maillet commented 9 years ago

Hello popcornmix. Hello everyone.

I noticed that the feature I needed already existed. This is great.

So I could make a auto_stop_pause option that removes the pause before the buffer is filled. Below is a part of my code that I put in the main loop.

if (m_Pause && auto_stop_pause && (m_player_video.GetLevel() > maxipercent || m_player_audio.GetLevel() > maxipercent)) { printf("Auto Replay because video buffer is filled in %d and audio buffer at %d \r\n", m_player_video.GetLevel(), m_player_audio.GetLevel()); fflush(stdout); m_Pause = false; if (m_has_subtitle) m_player_subtitles.Resume(); }

Subtitles for the buffer is particular:

m_subtitle_buffers.resize(stream_count, circular_buffer(32));

Is there a design bug here? Is it normal to have --audio_queue --video_queue but not --subtitle_queue?

If I replace circular_buffer by the type vector with my auto_stop_pause = true the problem would be solved, right?

Thank you all for having developed this great software.

Note: I created a proxy to register the udp flow in a circular file and I launched omxplayer on this file with --loop. It works fairly well but is there an image jump.

It would take a --loopToZero option ;-)

See you soon

Bonjour popcornmix. Bonjour tout le monde.

J'ai remarqué que la fonction que j'avais besoin existait déjà. C'est génial.

J'ai donc pu faire une option auto_stop_pause qui enleve la Pause avant que le buffer ne soit remplit. Ci dessous une partie de mon code que j'ai mis dans la boucle principal.

if (m_Pause && auto_stop_pause && (m_player_video.GetLevel() > maxipercent || m_player_audio.GetLevel() > maxipercent)) { printf("Auto Replay because video buffer is filled in %d and audio buffer at %d \r\n", m_player_video.GetLevel(), m_player_audio.GetLevel()); fflush(stdout); m_Pause = false; if (m_has_subtitle) m_player_subtitles.Resume(); }

Pour les sous-titres le buffer est particulier :

m_subtitle_buffers.resize(stream_count, circular_buffer(32));

Y a t-il un bug de conception ici ? Est ce normal d'avoir --audio_queue --video_queue mais pas --subtitle_queue ?

Si je remplace circular_buffer par le type vector avec mon auto_stop_pause =true le probleme serait résolu, non ?

Merci a tous d'avoir développé ce super logiciel.

Nota: j'ai créé un proxy pour enregistrer le flux udp dans un fichier circulaire et j'ai lancé omxplayer sur ce fichier avec --loop. Ca marche a peu près bien mais il y a un saut d'image.

Il faudrait une option --loopToZero ;-)

A bientot