spacepaste

  1.  
  2. def extract_image_from_video(video_input, name_output, timestamps):
  3. ret = "Error"
  4. try:
  5. index=0
  6. select_filter = "-filter:v \"select="
  7. for ttp in timestamps:
  8. select_filter += "\'lt(prev_pts*TB\,"+str(ttp)+")*gte(pts*TB\,"+str(ttp)+")"
  9. index=index+1
  10. if(index < len(timestamps)):
  11. select_filter += " + "
  12. else:
  13. select_filter += "\'\""
  14. print('select_filter is: '+ select_filter)
  15. print(video_input)
  16. print(timestamps)
  17. print("\n\t Extracting video frame from file {} at timestamps {}\n").format(video_input, timestamps)
  18. print("exiting")
  19. return ret
  20. except ValueError:
  21. return("Oops! error...")
  22.