VLC.py Occasionaly Fails To Open File

*nix specific usage questions
doylep
Blank Cone
Blank Cone
Posts: 15
Joined: 24 Mar 2017 01:38

VLC.py Occasionaly Fails To Open File

Postby doylep » 24 Mar 2017 02:02

Hi all,

I am running videos in VLC through vlc.py. 95% of the time, the video plays normally with no errors. Every once in a while, a video fails to play and I receive three errors:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc428ca22c0] moov atom not found
[00007fc428ce47f8] avformat demux error: Could not open <filename>: Unknown error 1094995529
[00007fc428ce47f8] ps demux error: cannot peek

Immediately attempting to replay the file usually works, but since media_player_instance.play() returns normally, I have no way of detecting the error from within vlc.py.

Any suggestions on how to hack around the problem or debug it more thoroughly?

Thanks for your help,
Patton

Additional clarification: VLC can play all the video files; the failure is random and does not seem to be linked to a particular file or subset of files.

doylep
Blank Cone
Blank Cone
Posts: 15
Joined: 24 Mar 2017 01:38

Re: VLC.py Occasionaly Fails To Open File

Postby doylep » 29 Mar 2017 06:49

For anyone following this thread, the issue and errors arise from the MediaPlayer.set_media() function. Adding a short delay (0.05 seconds) before using this function seems to resolve the issue, but more testing is necessary to make sure that the problem is really gone.

doylep
Blank Cone
Blank Cone
Posts: 15
Joined: 24 Mar 2017 01:38

Re: VLC.py Occasionaly Fails To Open File

Postby doylep » 02 Apr 2017 05:57

After fairly extensive testing, the error has not reappeared. I'm not sure why the short delay would prevent the error, but perhaps a pervious MediaPlayer function call was occupying the VLC instance and preventing it from properly executing MediaPlayer.set_media().

doylep
Blank Cone
Blank Cone
Posts: 15
Joined: 24 Mar 2017 01:38

Re: VLC.py Occasionaly Fails To Open File

Postby doylep » 02 Apr 2017 22:07

Of course, no later than posting that reply did the error reappear (I would estimate the frequency to be around 1% of the time). I haven't been able to track down the culprit, but I will continue to investigate and report back.

If anyone has any thoughts, they are appreciated.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: VLC.py Occasionaly Fails To Open File

Postby Jean-Baptiste Kempf » 04 Apr 2017 17:57

Maybe because the parsing is being done at the same time? Can you listen to the parsing event?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

doylep
Blank Cone
Blank Cone
Posts: 15
Joined: 24 Mar 2017 01:38

Re: VLC.py Occasionaly Fails To Open File

Postby doylep » 09 Apr 2017 18:02

Sorry for the slow response!

I can certainly try to listen for the parsing event, but I'm not sure how it is triggered (or how to listen to it). I assume you mean VLC is still in the process of parsing the file when I try to play it? Thanks for the suggestion! I will try to figure it out; if you know the relevant section of the manual, I would appreciate it.

Since last reporting in (and after inserting the delay before set_media()), I have narrowed the scope of the problem. Only two of our ~100 videos seem to experience any problem, but these two videos fail to load ~20% of the time.

*** Temporary solution ***
For anyone looking for an immediate solution, I have been able to dramatically reduce the incidence of failure by simply loading these two videos twice. The failure is silent and the currently playing video continues to play, so if the second call to load the video fails, the first is likely to have succeeded and the video will play. Obviously not an ideal fix, but it has reduced the failure rate to ~4%.

*** Next test ***
I am going to try using the MediaPlayer.set_mrl() function rather than the MediaPlayer.set_media() function. Based on my reading of vlc.py, these are identical, but perhaps there is some internal error checking that I'm unaware of. At the very least, it cleans up my code a bit.

If this doesn't work, I will try looking into the parsing event as Jean-Baptiste suggested.

doylep
Blank Cone
Blank Cone
Posts: 15
Joined: 24 Mar 2017 01:38

Re: VLC.py Occasionaly Fails To Open File

Postby doylep » 25 Aug 2017 18:14

Update, for anyone experiencing a similar problem:

After a great deal of debugging, I believe I have tracked my issue not to the set_mrl() function as I originally expected, but instead to the get_length() function. My use case demands that when a video reaches its end, the player is reset to an idle video. Thus, after loading the video, it sets a timeout for when the player should be reset based on the length of the video. I believe (and have so far confirmed) that get_length() occasionally returns 0 which causes the player to be immediately reset (and skip the new video that was requested).

Here is a python code snippet of my solution that checks for an invalid get_length():

Code: Select all

# Loop five times until we get a reasonable timeout length = 0 for x in xrange(5): # Load the filename as new media self.video.set_mrl(filename) # Wait a little bit and play the media time.sleep(0.05) self.video.play() # Wait a little bit and then get the length of the video time.sleep(0.05) length = self.video.get_length() # If the length is reasonable, move on if (length > 2): break # Otherwise, warn the system and try again self.send("WARNING: Repaired Video Error.") time.sleep(0.05) # Calculate the time to reset the video self.timeout = (datetime.datetime.now() + datetime.timedelta(milliseconds = (length - 100)))
Thanks again for your help here - I hope this update helps someone else!
Patton


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 18 guests