Last active
April 18, 2021 08:46
-
-
Save mhanney/dc329b1d9bff032b3600a1f7b44099e5 to your computer and use it in GitHub Desktop.
Revisions
-
mhanney revised this gist
Mar 7, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -186,3 +186,4 @@ http://stackoverflow.com/questions/33624016/why-sliced-thread-affect-so-much-on- http://www.waveguide.se/?article=creating-dvb-t-compatible-mpeg2-streams-using-ffmpeg http://stackoverflow.com/questions/12020430/look-for-fastest-video-encoder-with-least-lag-to-stream-webcam-streaming-to-ipad/12085571 -
mhanney revised this gist
Mar 7, 2017 . 1 changed file with 24 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ ffmpeg -loglevel error ^ -f dshow ^ -i video="USB Video Device":audio="Microphone (USB Audio Device)" ^ -vcodec libx264 ^ -preset veryfast ^ -tune zerolatency ^ -thread_type slice ^ -slices 4 ^ -intra-refresh 1 ^ -r 30 ^ -s 800:600 ^ -aspect 4:3 ^ -acodec aac ^ -ar 44100 ^ -crf 22 ^ -b:a 128K ^ -maxrate:v 900k ^ -bufsize:v 90k ^ -pix_fmt yuv420p ^ -refs 1 ^ -subq 3 ^ -trellis 2 ^ -async 1 ^ -f mpegts udp://192.168.0.123:35001?pkt_size=1316 -
mhanney revised this gist
Mar 6, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
mhanney revised this gist
Mar 6, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,6 +79,8 @@ ffmpeg -list_devices true -f dshow -i dummy Solution Mac OSX ================ ffmpeg installed using [brew](https://brew.sh/) package manager on Yosemite ``` ffmpeg -loglevel error \ -f avfoundation \ @@ -184,5 +186,3 @@ http://stackoverflow.com/questions/33624016/why-sliced-thread-affect-so-much-on- http://www.waveguide.se/?article=creating-dvb-t-compatible-mpeg2-streams-using-ffmpeg -
mhanney revised this gist
Mar 6, 2017 . 1 changed file with 47 additions and 37 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,26 @@ Solution ideally needs to be windows based Solution - Windows ================== Using ffmpeg-20161130-4e6d1c1-win64-static.zip for 64 bit Windows, Windows 10, which includes libx264 [https://ffmpeg.zeranoe.com/builds/win64/static/](https://ffmpeg.zeranoe.com/builds/win64/static/) ``` ffmpeg version N-82713-g4e6d1c1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.4.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib libavutil 55. 41.101 / 55. 41.101 libavcodec 57. 66.108 / 57. 66.108 libavformat 57. 58.101 / 57. 58.101 libavdevice 57. 2.100 / 57. 2.100 libavfilter 6. 67.100 / 6. 67.100 libswscale 4. 3.101 / 4. 3.101 libswresample 2. 4.100 / 2. 4.100 libpostproc 54. 2.100 / 54. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... ``` start-stream.bat ``` ffmpeg -loglevel error ^ @@ -31,7 +51,7 @@ ffmpeg -loglevel error ^ -b:v 2.5M ^ -minrate:v 900k ^ -maxrate:v 2.5M ^ -bufsize:v 5M ^ -b:a 128K ^ -pix_fmt yuv420p ^ -f mpegts udp://192.168.0.123:35001?pkt_size=1316 @@ -78,7 +98,7 @@ ffmpeg -loglevel error \ -b:v 2.5M \ -minrate:v 900k \ -maxrate:v 2.5M \ -bufsize:v 5M \ -b:a 128K \ -pix_fmt yuv420p \ -f mpegts udp://192.168.0.123:35001?pkt_size=1316 @@ -103,47 +123,49 @@ Example output (Late 2013 iMac 21.5") What all the arguments mean: == `ffmpeg -loglevel error` - logging level (quiet, error, warning). `-f dshow` - use direct show as file type. `-i video="USB Video Device":audio="Microphone (USB Audio Device)"` - inputs (use ffmpeg -list_devices true -f dshow -i dummy to get list of possible sources). `-vcodec libx264` - video codec (libx264 for h264). `-acodec aac` - audio codec (aac). `-preset ultrafast` - encoding preset (ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo). `-tune zerolatency` - tune zerolatency sends an I-Frame (complete pic) every frame so that users to not need to wait for intermetiate frames to complete. `-thread_type slice` - slice-based threading tells all CPU threads work on the same frame, reducing latency a lot. `-slices 1` - has to be 1 for vMix to decode the stream, don't know why. `-intra-refresh 1` intra-refresh has to be set to 1 because vMix expects a latency of 1 frame, I think. `-r 30` - framerate. `-g 60` - GOP (Group of Pictures), simply multiply your output frame rate * 2. `-s 800x600` - scale my webcam's native picture is 1600x1200, so I scale it down. `-aspect 4:3` - aspect ratio, my webcam is a Logitec 9000 which is 4:3. `-acodec aac` - audio encode using AAC. `-ar 44100` - audio sample rate 44.1 KHz. `-b:v 2.5M` - desired bitrate for video 2.5 Mbps, can play with this. `-minrate:v 900k` - min data rate video 900k, can play with this. `-maxrate:v 2.5M` - min data rate video 2.5 Mbps, can play with this. `-bufsize:v 5M` - buffer size for encoding, double max data rate seems to be a good starting point. `-b:a 128K` - desired bitrate for audio 128 Kbps, can play with this. `-pix_fmt yuv420p ` - color space, has to be yuv420p for vMix to decode properly. `-bufsize 5000k` - buffer size (double max data rate seems to be a good starting point) @@ -158,21 +180,9 @@ https://trac.ffmpeg.org/wiki/StreamingGuide https://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping http://stackoverflow.com/questions/33624016/why-sliced-thread-affect-so-much-on-realtime-encoding-using-ffmpeg-x264 http://www.waveguide.se/?article=creating-dvb-t-compatible-mpeg2-streams-using-ffmpeg -
mhanney revised this gist
Mar 6, 2017 . 2 changed files with 68 additions and 63 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,29 +17,36 @@ ffmpeg -loglevel error ^ -f dshow ^ -i video="USB Video Device":audio="Microphone (USB Audio Device)" ^ -vcodec libx264 ^ -preset ultrafast ^ -tune zerolatency ^ -thread_type slice ^ -slices 1 ^ -intra-refresh 1 ^ -r 30 ^ -g 60 ^ -s 800x600 ^ -aspect 4:3 ^ -acodec aac ^ -ar 44100 ^ -b:v 2.5M ^ -minrate:v 900k ^ -maxrate:v 2.5M ^ -bufsize:v 2.6M ^ -b:a 128K ^ -pix_fmt yuv420p ^ -f mpegts udp://192.168.0.123:35001?pkt_size=1316 ``` Test with VLC ``` udp://@192.168.0.123:35001 ``` Test with vMIX ``` Transport Stream over UDP Port 35001 ``` How to list available devices (for -i video="") on Windows @@ -56,24 +63,25 @@ Solution Mac OSX ffmpeg -loglevel error \ -f avfoundation \ -i "default" \ -vcodec libx264 \ -preset ultrafast \ -tune zerolatency \ -thread_type slice \ -slices 1 \ -intra-refresh 1 \ -r 30 \ -g 60 \ -s 800x600 \ -aspect 4:3 \ -acodec aac \ -ar 44100 \ -b:v 2.5M \ -minrate:v 900k \ -maxrate:v 2.5M \ -bufsize:v 2.6M \ -b:a 128K \ -pix_fmt yuv420p \ -f mpegts udp://192.168.0.123:35001?pkt_size=1316 ``` How to list available devices (for -i video="") on Mac OSX @@ -105,44 +113,41 @@ What all the arguments mean: `-acodec aac` - audio codec (aac) `-preset ultrafast` - encoding preset (ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo) `-tune zerolatency` - tune zerolatency sends an I-Frame (complete pic) every frame so that users to not need to wait for intermetiate frames to complete. `-thread_type slice` - slice-based threading tells all CPU threads work on the same frame, reducing latency `-slices 1` - has to be 1 for vMix to decode the stream, don't know why. `-intra-refresh 1` intra-refresh has to be set to 1 because vMix expects a latency of 1 frame, I think `-r 30` - framerate `-g 60` - GOP (Group of Pictures), simply multiply your output frame rate * 2 `-s 800x600` - scale my webcam's native picture is 1600x1200, so I scale it down `-aspect 4:3` - aspect ratio, my webcam is a Logitec 9000 which is 4:3 `-acodec aac` - audio encode using AAC `-ar 44100` - audio sample rate 44.1 KHz `-b:v 2.5M` - desired bitrate for video 2.5 Mbps, can play with this `-minrate:v 900k` - min data rate video 900k, can play with this `-maxrate:v 2.5M` - min data rate video 2.5 Mbps, can play with this `-bufsize:v 5M` - buffer size for encoding, double max data rate seems to be a good starting point `-b:a 128K` - desired bitrate for audio 128 Kbps, can play with this `-bufsize 5000k` - buffer size (double max data rate seems to be a good starting point) `-f mpegts udp://192.168.0.123:35001?pkt_size=1316` output format mpegts udp IP address, port, packet size - really important - The size of an MPEG-TS packet is 188 Bytes and 7 of them will fit into an Ethernet frame, 7*188=1316. References This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,21 +2,21 @@ ffmpeg -loglevel error ^ -f dshow ^ -i video="USB Video Device":audio="Microphone (USB Audio Device)" ^ -vcodec libx264 ^ -preset ultrafast ^ -tune zerolatency ^ -thread_type slice ^ -slices 1 ^ -intra-refresh 1 ^ -r 30 ^ -g 60 ^ -s 800x600 ^ -aspect 4:3 ^ -acodec aac ^ -ar 44100 ^ -b:v 2.5M ^ -minrate:v 900k ^ -maxrate:v 2.5M ^ -bufsize:v 5M ^ -b:a 128K ^ -pix_fmt yuv420p ^ -f mpegts udp://192.168.0.123:35001?pkt_size=1316 -
mhanney revised this gist
Mar 6, 2017 . 1 changed file with 42 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,8 @@ This could by transport stream UDP or TCP as long as the encapsulation is mpegts Solution ideally needs to be windows based Solution - Windows ================== start-stream.bat ``` @@ -42,19 +42,55 @@ Test with VLC udp://@192.168.0.123:1234 ``` How to list available devices (for -i video="") on Windows == ``` ffmpeg -list_devices true -f dshow -i dummy ``` Solution Mac OSX ================ ``` ffmpeg -loglevel error \ -f avfoundation \ -i "default" \ -vcodec libx264 \ -acodec aac \ -preset veryfast \ -tune zerolatency \ -r 30 \ -g 60 \ -threads 4 \ -s 1280x720 \ -aspect 16:9 \ -b:v 2340k \ -b:a 160k \ -maxrate 2500k \ -bufsize 5000k \ -me_method hex \ -subq 1 \ -trellis 0 \ -refs 1 \ -f mpegts udp://192.168.0.6:1234 ``` How to list available devices (for -i video="") on Mac OSX == ``` ffmpeg -f avfoundation -list_devices true -i "" ``` Example output (Late 2013 iMac 21.5") ``` [AVFoundation input device @ 0x7f89b9c22920] AVFoundation video devices: [AVFoundation input device @ 0x7f89b9c22920] [0] FaceTime HD Camera (Built-in) [AVFoundation input device @ 0x7f89b9c22920] [1] Capture screen 0 [AVFoundation input device @ 0x7f89b9c22920] AVFoundation audio devices: [AVFoundation input device @ 0x7f89b9c22920] [0] Built-in Microphone ``` What all the arguments mean: == -
mhanney revised this gist
Mar 6, 2017 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,10 +45,17 @@ udp://@192.168.0.123:1234 How to list available devices (for -i video="") == Windows ``` ffmpeg -list_devices true -f dshow -i dummy ``` Max OSX ``` ffmpeg -f avfoundation -list_devices true -i "" ``` What all the arguments mean: == -
mhanney revised this gist
Mar 5, 2017 . 1 changed file with 25 additions and 26 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,55 +52,54 @@ ffmpeg -list_devices true -f dshow -i dummy What all the arguments mean: == `ffmpeg -loglevel error` - logging level (quiet, error, warning) `-f dshow` - use direct show as file type `-i video="USB Video Device":audio="Microphone (USB Audio Device)"` - inputs (use ffmpeg -list_devices true -f dshow -i dummy to get list of possible sources) `-vcodec libx264` - video codec (libx264 for h264) `-acodec aac` - audio codec (aac) `-preset veryfast` - encoding preset (ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo) `-tune zerolatency` - tune zerolatency sends an I-Frame (complete pic) every frame so that users to not need to wait for intermetiate frames to complete. `-r 30` - framerate `-g 60` - GOP (Group of Pictures), simply multiply your output frame rate * 2 `-threads 4` how many CPU threads to use for encoding `-pix_fmt yuv420p` - pixture format colour space `-s 800x600` - scale my webcam's native picture is 1600x1200, so I scale it down `-aspect 4:3` - aspect ratio, my webcam is a Logitec 9000 which is 4:3 `-b:v 2340k` - bandwidth video `-b:a 160k` - bandwidth audio `-maxrate 2500k` - max data rate `-bufsize 5000k` - buffer size (double max data rate seems to be a good starting point) `-me_method zero` - motion estimate method, zero : zero motion estimation (fastest) - not much motion in webcam full : full motion estimation (slowest) epzs : EPZS motion estimation (default) `-subq 1` An extremely important encoding parameter which determines what algorithms are used for both subpixel motion searching and partition decision. 1: Fastest, but extremely low quality. Should be avoided except on first pass encoding. 1 is ok for faces on webcams that have very little motion 2-5: Progressively better and slower, 5 serves as a good medium for higher speed encoding. 6-7: 6 is the default. Activates rate-distortion optimization for partition decision. This can considerably improve efficiency, though it has a notable speed cost. 6 activates it in I/P frames, and subme7 activates it in B frames. `-refs 4` One of H.264's most useful features is the abillity to reference frames other than the one immediately prior to the current frame. This parameter lets one specify how many references can be used, through a maximum of 16. Increasing the number of refs increases the DPB (Decoded Picture Buffer) requirement, which means hardware playback devices will often have strict limits to the number of refs they can handle. In live-action sources, more reference have limited use beyond 4-8, but in cartoon sources up to the maximum value of 16 is often useful. More reference frames require more processing power because every frame is searched by the motion search (except when an early skip decision is made). The slowdown is especially apparent with slower motion estimation methods. Recommended default: -refs 6 `-f mpegts udp://192.168.0.123:1234` - output format mpegts udp IP address References -
mhanney revised this gist
Mar 5, 2017 . 1 changed file with 16 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -111,5 +111,21 @@ https://trac.ffmpeg.org/wiki/StreamingGuide https://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping Tested Using ffmpeg-20161130-4e6d1c1-win64-static.zip for 64 bit Windows, Windows 10, which includes libx264 ``` ffmpeg version N-82713-g4e6d1c1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.4.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib libavutil 55. 41.101 / 55. 41.101 libavcodec 57. 66.108 / 57. 66.108 libavformat 57. 58.101 / 57. 58.101 libavdevice 57. 2.100 / 57. 2.100 libavfilter 6. 67.100 / 6. 67.100 libswscale 4. 3.101 / 4. 3.101 libswresample 2. 4.100 / 2. 4.100 libpostproc 54. 2.100 / 54. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... ``` -
mhanney revised this gist
Mar 5, 2017 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,6 @@ Stream webcam and audio source from PC via the internet to a vmix install with a This could by transport stream UDP or TCP as long as the encapsulation is mpegts and encoded with h264 and aac. Solution ideally needs to be windows based -
mhanney created this gist
Mar 5, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,117 @@ Requirement =========== Stream webcam and audio source from PC via the internet to a vmix install with as little lag as possible. This could by transport stream UDP or TCP as long as the encapsulation is mpegts and encoded with h264 and aac. I'm also exploring unreal media server as well as MS media options. Solution ideally needs to be windows based Solution ======== start-stream.bat ``` ffmpeg -loglevel error ^ -f dshow ^ -i video="USB Video Device":audio="Microphone (USB Audio Device)" ^ -vcodec libx264 ^ -acodec aac ^ -preset veryfast ^ -tune zerolatency ^ -r 30 ^ -g 60 ^ -threads 4 ^ -pix_fmt yuv420p ^ -s 800x600 ^ -aspect 4:3 ^ -b:v 2340k ^ -b:a 160k ^ -maxrate 2500k ^ -bufsize 5000k ^ -me_method hex ^ -subq 1 ^ -trellis 0 ^ -refs 1 ^ -f mpegts udp://192.168.0.123:1234 ``` Test with VLC ``` udp://@192.168.0.123:1234 ``` How to list available devices (for -i video="") == ``` ffmpeg -list_devices true -f dshow -i dummy ``` What all the arguments mean: == ffmpeg -loglevel error - logging level (quiet, error, warning) -f dshow - use direct show as file type -i video="USB Video Device":audio="Microphone (USB Audio Device)" - inputs (use ffmpeg -list_devices true -f dshow -i dummy to get list of possible sources) -vcodec libx264 - video codec (libx264 for h264) -acodec aac - audio codec (aac) -preset veryfast - encoding preset (ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo) -tune zerolatency - tune zerolatency sends an I-Frame (complete pic) every frame so that users to not need to wait for intermetiate frames to complete. -r 30 - framerate -g 60 - GOP (Group of Pictures), simply multiply your output frame rate * 2 -threads 4 how many CPU threads to use for encoding -pix_fmt yuv420p - pixture format colour space -s 800x600 - scale my webcam's native picture is 1600x1200, so I scale it down -aspect 4:3 - aspect ratio, my webcam is a Logitec 9000 which is 4:3 -b:v 2340k - bandwidth video -b:a 160k - bandwidth audio -maxrate 2500k - max data rate -bufsize 5000k - buffer size (double max data rate seems to be a good starting point) -me_method zero - motion estimate method, zero : zero motion estimation (fastest) - not much motion in webcam full : full motion estimation (slowest) epzs : EPZS motion estimation (default) -subq 1 An extremely important encoding parameter which determines what algorithms are used for both subpixel motion searching and partition decision. 1: Fastest, but extremely low quality. Should be avoided except on first pass encoding. 1 is ok for faces on webcams that have very little motion 2-5: Progressively better and slower, 5 serves as a good medium for higher speed encoding. 6-7: 6 is the default. Activates rate-distortion optimization for partition decision. This can considerably improve efficiency, though it has a notable speed cost. 6 activates it in I/P frames, and subme7 activates it in B frames. -refs 4 One of H.264's most useful features is the abillity to reference frames other than the one immediately prior to the current frame. This parameter lets one specify how many references can be used, through a maximum of 16. Increasing the number of refs increases the DPB (Decoded Picture Buffer) requirement, which means hardware playback devices will often have strict limits to the number of refs they can handle. In live-action sources, more reference have limited use beyond 4-8, but in cartoon sources up to the maximum value of 16 is often useful. More reference frames require more processing power because every frame is searched by the motion search (except when an early skip decision is made). The slowdown is especially apparent with slower motion estimation methods. Recommended default: -refs 6 -f mpegts udp://192.168.0.123:1234 - References https://trac.ffmpeg.org/wiki/EncodingForStreamingSites https://trac.ffmpeg.org/wiki/StreamingGuide https://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ ffmpeg -loglevel error ^ -f dshow ^ -i video="USB Video Device":audio="Microphone (USB Audio Device)" ^ -vcodec libx264 ^ -acodec aac ^ -preset veryfast ^ -tune zerolatency ^ -r 30 ^ -g 60 ^ -threads 4 ^ -pix_fmt yuv420p ^ -s 800x600 ^ -aspect 4:3 ^ -b:v 2340k ^ -b:a 160k ^ -maxrate 2500k ^ -bufsize 5000k ^ -me_method hex ^ -subq 1 ^ -trellis 0 ^ -refs 1 ^ -f mpegts udp://192.168.0.123:1234