Skip to content

Instantly share code, notes, and snippets.

@suhanlee
Last active April 18, 2017 08:17
Show Gist options
  • Save suhanlee/5dac2cdfd9005e1edb95e14fa98f01d5 to your computer and use it in GitHub Desktop.
Save suhanlee/5dac2cdfd9005e1edb95e14fa98f01d5 to your computer and use it in GitHub Desktop.
ffmpeg
Port 8090
# bind to all IPs aliased or not
BindAddress 0.0.0.0
# max number of simultaneous clients
MaxClients 1000
# max bandwidth per-client (kb/s)
MaxBandwidth 100000
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 1G
ACL allow 127.0.0.1
</Feed>
<Stream live.flv>
Format flv
Feed feed1.ffm
VideoCodec libx264
VideoFrameRate 30
VideoSize 1280x720
VideoBitRate 8000
AudioCodec aac
Strict -2
AudioBitRate 128
AudioChannels 2
AudioSampleRate 44100
</Stream>
<Stream face.flv>
Format flv
Feed feed1.ffm
VideoCodec libx264
VideoFrameRate 30
VideoSize 640x480
VideoBitRate 4000
AudioCodec aac
Strict -2
AudioBitRate 128
AudioChannels 2
AudioSampleRate 44100
</Stream>
<Stream stat.html>
Format status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
</Stream>
$ ffmpeg -y \
-i sample.mov \
-codec copy \
-bsf h264_mp4toannexb \
-map 0 \
-f segment \
-segment_time 10 \
-segment_format mpegts \
-segment_list "/Library/WebServer/Documents/vod/prog_index.m3u8" \
-segment_list_type m3u8 \
"/Library/WebServer/Documents/vod/fileSequence%d.ts"
$ ffmpeg -y \
-i udp://127.0.0.1:5555 \
-map 0 \
-f segment \
-segment_time 10 \
-segment_format mpegts \
-segment_list "/Library/WebServer/Documents/live/prog_index.m3u8" \
-segment_list_size 3 \
-segment_list_flags +live \
-segment_list_type m3u8 \
"/Library/WebServer/Documents/live/fileSequence%d.ts"
<!DOCTYPE html>
<html>
<body>
<video
autoplay
controls
src="prog_index.m3u8"
height="540" width="960">
</video>
</body>
</html>
#! /bin/bash
#
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="veryfast" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
SOURCE="0:0" # Source UDP
KEY="pmyt-e8t9-f8xa-ftk0"
ffmpeg \
-f avfoundation -framerate 30 \
-i "$SOURCE" -deinterlace \
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \
-acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 712000 -bufsize 512k \
-f flv "$YOUTUBE_URL/$KEY"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment