Skip to content

Instantly share code, notes, and snippets.

@sscarbal
sscarbal / find_video_metadata.py
Last active June 10, 2022 15:07
Python function to retrieve the timestamps of a input video file using ffmpeg.
import subprocess
import shlex
import json
# function to retrieve the timestamps of the input video file
def findVideoMetadata(pathToInputVideo):
cmd = "ffprobe -v quiet -print_format json -show_entries packet=pts_time"
args = shlex.split(cmd)
args.append(pathToInputVideo)
# run the ffprobe process, decode stdout into utf-8 & convert to JSON
@sscarbal
sscarbal / serialize_image.py
Last active January 28, 2019 16:29
Image and metadata serialization/deserialization to/from json.
from scipy import misc
import json
import cv2
import time
import datetime as dt
import base64
import io
from urllib.request import urlopen