I want to know when omxplayer starts playing a live stream link. Some time this takes 4-5 second some times 6-7 second.
When I execute os.system('omxplayer '+url)
, I immediately get the following message:
no xset in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
which: no xrefresh in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
then when the live stream starts (after 5-7 second), I get:
Video codec omx-h264 width 1280 height 720 profile 578 fps 25.000000
Audio codec aac channels 2 samplerate 44100 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
V:PortSettingsChanged: 1280x720@25.00 interlace:0 deinterlace:0 anaglyph:0 par:1.00 layer:0 alpha:255
I am trying to get the second message via subprocess. But I never get it. How can I get the second message or how can I know when omxplayer start working?
Thanks
#!/usr/bin/python2
import sys, os, time
from subprocess import PIPE, Popen
url="http://livestreamlink.m3u8"
def Main():
proc=Popen(['omxplayer',url], stdout=PIPE)
time.sleep(5)
print proc.communicate()[0]
if __name__ == "__main__":
Main()