Skip to content

Instantly share code, notes, and snippets.

@prprhyt
Created September 22, 2020 11:56
Show Gist options
  • Save prprhyt/5ac0ae744eafc5efedd7a542d09b9114 to your computer and use it in GitHub Desktop.
Save prprhyt/5ac0ae744eafc5efedd7a542d09b9114 to your computer and use it in GitHub Desktop.
LIVE STREAMING WITH RULLZ HDMI VIDEO CAPTURE
WIDTH="1280"
HEIGHT="720"
FPS="30"
VIDEO_BITRATE="2500000" #=2500k
INPUT_SOURCE="/dev/video0"
THREAD_QUEUE_SIZE=8192
URL_WITH_KEY=...
v4l2-ctl --device ${INPUT_SOURCE} --set-fmt-video=width=${WIDTH},height=${HEIGHT},pixelformat=MJPG
ffmpeg -f alsa -ac 1 -threads 0 -thread_queue_size ${THREAD_QUEUE_SIZE} -i hw:1,0 -f v4l2 -input_format mjpeg -video_size ${WIDTH}x${HEIGHT} -i ${INPUT_SOURCE} -c:v libx264 -preset veryfast -vb ${VIDEO_BITRATE} -maxrate ${VIDEO_BITRATE} -bufsize $(($VIDEO_BITRATE * 2)) -framerate ${FPS} -g $(($FPS * 2)) -vsync 1 -af aresample=async=1 -vf format=yuv420p,fps=${FPS} -f flv ${URL_WITH_KEY}
@prprhyt
Copy link
Author

prprhyt commented Sep 22, 2020

1000円HDMIキャプチャスティックでtwitchやyoutube liveでライブストリーミングするやつ
ubuntu18.04+ffmpeg(3.4.8-0ubuntu0.2)で動作確認済み

HDMIキャプチャはAliexpressで入手(1000円強)
https://ja.aliexpress.com/item/4001043423008.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment