Skip to content

Instantly share code, notes, and snippets.

import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import torch.nn.functional as F
import matplotlib.pyplot as plt
import numpy as np
@phuocphn
phuocphn / webcam_gstreamer
Created September 6, 2018 15:18 — forked from yoganand/webcam_gstreamer
Gstreamer Pipeline for webcam to rtmpserver
gst-launch-1.0 v4l2src ! "video/x-raw,width=640,height=480,framerate=15/1" ! \
x264enc bitrate=1000 ! video/x-h264,profile=high ! h264parse ! queue ! \
flvmux name=mux pulsesrc ! audioresample ! audio/x-raw,rate=48000 ! \
queue ! voaacenc bitrate=32000 ! queue ! mux. mux. ! rtmpsink location="rtmp://127.0.0.1/mytv/mystream live=1"
@phuocphn
phuocphn / gEncodeH264WithPreviews.sh
Created September 6, 2018 14:25 — forked from jetsonhacks/gEncodeH264WithPreviews.sh
Using Gstreamer, take a h264 stream from a Logitech c920, preview it on the display and save it to a file along with the webcam audio.
#!/bin/sh
# Preview and save webcam video on NVIDIA Jetson TK1
# Grab audio and video (in h264 format) from Logitech c920 @ 1920x1080
# Preview @ 1280x720 on screen
# Store video to file named gEncode1080p.mp4
# Logitech c920 is video1 on this machine
VELEM="v4l2src device=/dev/video1 do-timestamp=true"
# Video capability from the camera - get h264 1920x1080
VCAPS="video/x-h264, width=1920, height=1080, framerate=30/1"
@phuocphn
phuocphn / results.txt
Created May 11, 2018 16:11 — forked from mikeboers/results.txt
Comparing speed of reading video frames via a subprocess, or via PyAV
2013-10-05 10:19:59 mikeboers@maxwell: ~/Documents/Python/PyAV
$ time python video_frames_via_pipe.py
real 0m0.564s
user 0m0.729s
sys 0m0.241s
2013-10-05 10:20:01 mikeboers@maxwell: ~/Documents/Python/PyAV
$ time python video_frames_via_pyav.py