Jump to content
Arnold Chan

Is there any Python driven video player that runs on Tinker Board

Recommended Posts

Hi,

Seems VLC doesn't work on Tinker Board, do you guys know if there is any video player that can be controlled by Python and workable on Tinker Board (Edge R)?

Thanks

Arnold

Share this post


Link to post
Share on other sites

hello @Arnold Chan

for tinker edge r, there's built in"media player" available in the tinker os image for media streaming, however it's not python driven. 

if you're using other players, it may be laggy as tinker edge uses cpu to decode and read video.

Share this post


Link to post
Share on other sites

Here is my version of python-gstreamer dvr. You need to install the python-gst bidnings though:

pythong dvr -records 60s video - I have to fix the pipeline though because the clips are really big. 2+ gigs per minute

Quote

import gi 
import sys
from time import sleep
from datetime import datetime

gi.require_version('Gst', '1.0') #this may have to be adapted depending on your gst version.
from gi.repository import Gst, GObject

Gst.init(sys.argv)

#this is just to get the date and time into the output filename
now = datetime.now()
date_time = now.strftime("%m-%d-%Y_%H-%M-%S")

# the same pipeling you would use in gst-launch, starting from v4l2.... Note the ' #encompassing the whole pipeline, except the +str(date-time)+ which is excluded. Use #the plus to make python add a string with the date.
pipeline=Gst.parse_launch ('v4l2src ! video/x-raw,width=1280,height=720,framerate=12/1 ! queue ! mux. alsasrc ! audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse ! qtmux name=mux ! filesink location=rec_'+str(date_time)+'.mp4 sync=false')


def main():
  bus = pipeline.get_bus()      
  pipeline.set_state(Gst.State.PLAYING)
  print('Recording Dashcam')
  
  sleep(60) 
  print('Sending EOS')
  pipeline.send_event(Gst.Event.new_eos())
  print('Waiting for EOS')
  bus.timed_pop_filtered(Gst.CLOCK_TIME_NONE, Gst.MessageType.EOS)
  pipeline.set_state(Gst.State.NULL)

main()

 

dvr60s-dated.py

Edited by Kajan001

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...