Skip to content

Instantly share code, notes, and snippets.

@CasiaFan
CasiaFan / ffmpeg_python_with_gpu_acceleration.py
Created September 8, 2019 16:35
Use pipe to read ffmped decoded video frames with NVIDIA GPU hardware acceleration
import subprocess as sp
import cv2
import numpy as np
from PIL import Image
import tensorflow as tf
ffmpeg_cmd_1 = ["./ffmpeg", "-y",
"-hwaccel", "nvdec",
"-c:v", "h264_cuvid",
"-vsync", "0",