subprocess - Python communicate with omxplayer -
i want know when omxplayer starts playing live stream link. time takes 4-5 second times 6-7 second.
when execute os.system('omxplayer '+url)
, 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 live stream starts (after 5-7 second), 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 trying second message via subprocess. never it. how can second message or how can know when omxplayer start working?
thanks
#!/usr/bin/python2 import sys, os, time 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()
try this:
proc=popen(['omxplayer',url], stdout=pipe, stderr=pipe) print proc.communicate() # remove [0]
Comments
Post a Comment