api.video
SearchCtrl K

Features

Developers

What do my video output live stream details from ffmpeg mean?

August 11, 2021 - Erikka Innes in Live stream status

FFMPEG allows you to stream and live stream video, but sometimes what the output means can get confusing. If you've ever wondered what's going on with the output to your terminal, today we'll go through that information using Doug's popular livestream.a.video demo. If you like, go ahead and run the demo, then grab the output from your terminal. Or you can follow along with the sample I'm pasting here, which also came from a session using the livestream.a.video demo. We are going to go over every part of the information in the output, so if something seems obvious, skip ahead to the part you wanted to learn about.

Here's our sample. This sample shows a session where a live stream is started using my Mac and the Mac's iSight camera. I started it using the livestream.a.video demo through a Chrome browser. There might be some differences based on what computer you're on, so keep that in mind.


SERVER:Hello from mediarecorder-to-rtmp server!
SERVER:Please set rtmp destination before start streaming.
SERVER:rtmp destination set to:rtmp://broadcast.api.video/s/30087931-229e-42cf-b5f9-e91bcc1f7332
FFMPEG:ffmpeg version N-58069-gc253b180cb-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2021 the FFmpeg developers

FFMPEG:  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg

FFMPEG:  libavutil      57.  2.100 / 57.  2.100
  libavcodec     59.  3.102 / 59.  3.102
  libavformat    59.  4.101 / 59.  4.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.103 /  8.  0.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100

FFMPEG:Input #0, matroska,webm, from 'pipe:':
  Metadata:
    encoder         : Chrome
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
  Stream #0:1(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 240x240, SAR 1:1 DAR 1:1, 1k tbr, 1k tbn (default)

FFMPEG:Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (opus (native) -> aac (native))

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:VBV bufsize set but maxrate unspecified, ignored

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:using SAR=1/1

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:profile Constrained Baseline, level 3.0, 4:2:0, 8-bit

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:264 - core 164 r3065 ae03d92 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=3 sliced_threads=1 slices=3 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=30 keyint_min=16 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=25.0 qcomp=0.60 qpmin=0 qpmax=51 qpstep=4 ip_ratio=1.40 aq=0

FFMPEG:Output #0, flv, to 'rtmp://broadcast.api.video/s/30087931-229e-42cf-b5f9-e91bcc1f7332':

FFMPEG:  Metadata:

FFMPEG:    encoder         : 
FFMPEG:Lavf59.4.101
FFMPEG:

FFMPEG:  Stream #0:0
FFMPEG:(eng)
FFMPEG:: Video: h264 ([7][0][0][0] / 0x0007), yuv420p(progressive), 240x240 [SAR 1:1 DAR 1:1], q=2-31
FFMPEG:, 
FFMPEG:15 fps, 
FFMPEG:1k tbn
FFMPEG: (default)
FFMPEG:

FFMPEG:    Metadata:

FFMPEG:      encoder         : 
FFMPEG:Lavc59.3.102 libx264
FFMPEG:

FFMPEG:    Side data:

FFMPEG:      
FFMPEG:cpb: 
FFMPEG:bitrate max/min/avg: 0/0/0 buffer size: 5000 
FFMPEG:vbv_delay: N/A
FFMPEG:

FFMPEG:  Stream #0:1
FFMPEG:(eng)
FFMPEG:: Audio: aac (LC) ([10][0][0][0] / 0x000A), 22050 Hz, mono, fltp, 22 kb/s
FFMPEG: (default)
FFMPEG:

FFMPEG:    Metadata:

FFMPEG:      encoder         : 
FFMPEG:Lavc59.3.102 aac
FFMPEG:

FFMPEG:frame=    1 fps=0.0 q=22.0 size=       2kB time=00:00:00.74 bitrate=  26.0kbits/s speed=13.9x    

FFMPEG:frame=   57 fps=0.0 q=12.0 size=      25kB time=00:00:04.50 bitrate=  44.8kbits/s speed=6.71x    

FFMPEG:frame=   65 fps= 55 q=12.0 size=      29kB time=00:00:05.06 bitrate=  47.1kbits/s speed=4.26x    

FFMPEG:frame=   72 fps= 41 q=12.0 size=      31kB time=00:00:05.57 bitrate=  45.8kbits/s speed=3.18x    

FFMPEG:frame=   81 fps= 36 q=12.0 size=      34kB time=00:00:06.13 bitrate=  45.3kbits/s speed=2.69x    

FFMPEG:frame=   89 fps= 31 q=12.0 size=      37kB time=00:00:06.64 bitrate=  45.1kbits/s speed=2.35x    

FFMPEG:frame=   96 fps= 29 q=12.0 size=      41kB time=00:00:07.19 bitrate=  46.3kbits/s speed=2.16x    

FFMPEG:frame=  105 fps= 27 q=13.0 size=      44kB time=00:00:07.66 bitrate=  47.4kbits/s speed=1.98x    

FFMPEG:frame=  113 fps= 26 q=12.0 size=      47kB time=00:00:08.21 bitrate=  47.3kbits/s speed=1.87x    

FFMPEG:frame=  121 fps= 24 q=9.0 size=      52kB time=00:00:08.77 bitrate=  48.6kbits/s speed=1.77x    

FFMPEG:frame=  129 fps= 24 q=12.0 size=      54kB time=00:00:09.28 bitrate=  48.0kbits/s speed=1.69x    

FFMPEG:frame=  137 fps= 23 q=12.0 size=      57kB time=00:00:09.84 bitrate=  47.4kbits/s speed=1.64x    

FFMPEG:frame=  145 fps= 22 q=12.0 size=      59kB time=00:00:10.40 bitrate=  46.8kbits/s speed=1.59x    

FFMPEG:frame=  153 fps= 22 q=13.0 size=      64kB time=00:00:10.91 bitrate=  47.9kbits/s speed=1.55x    

FFMPEG:frame=  161 fps= 21 q=12.0 size=      66kB time=00:00:11.42 bitrate=  47.4kbits/s speed= 1.5x    

FFMPEG:frame=  169 fps= 21 q=12.0 size=      69kB time=00:00:11.98 bitrate=  47.0kbits/s speed=1.47x    

FFMPEG:frame=  176 fps= 20 q=12.0 size=      71kB time=00:00:12.53 bitrate=  46.3kbits/s speed=1.44x    

FFMPEG:frame=  185 fps= 20 q=12.0 size=      75kB time=00:00:13.00 bitrate=  47.4kbits/s speed=1.41x    

FFMPEG:frame=  193 fps= 20 q=12.0 size=      78kB time=00:00:13.56 bitrate=  46.9kbits/s speed=1.39x    

Hello from mediarecorder-to-rtmp server!

We're using an RTMP connection, which is based on TCP. So when I connect with my request to create a live stream, my client gets a response:

"SERVER:Hello from mediarecorder-to-rtmp server!"

I'm asked to provide my stream key, which is going to be what I will use to broadcast. Because of how the demo is set up, that's already been sent, so now the server tells me it's received the information about where I want to broadcast my live stream to:

"SERVER:Please set rtmp destination before start streaming. SERVER:rtmp destination set to:rtmp://broadcast.api.video/s/30087931-229e-42cf-b5f9-e91bcc1f7332"

The last part tells me what version of FFMPEG we're using and provides a link to static builds of FFmpeg for Linux kernels 3.2.0 and up. It also gives me copyright information - wow we've had FFMPEG for 22 years!

SERVER:Hello from mediarecorder-to-rtmp server!
SERVER:Please set rtmp destination before start streaming.
SERVER:rtmp destination set to:rtmp://broadcast.api.video/s/30087931-229e-42cf-b5f9-e91bcc1f7332
FFMPEG:ffmpeg version N-58069-gc253b180cb-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2021 the FFmpeg developers

Configuration details

The next part of the FFMPEG output shows us the configuration details for the live stream.

FFMPEG:  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg

In this section, we're told that FFMPEG was built with gcc 8. GCC stands for GNU Compiler Collection and it's the standard compiler for Linux. It's associated with the Linux distribution Debian (Debian GNU/Linux). The Debian Linux distribution is super popular and while it's less user friendly than distributions like Ubuntu, it is great for people who like free and open source software.

And now let's take a look at the configuration details:

--enable-gpl --enable-version3 These are FFMPEG licensing options. Together these flags say that you want to allow the use of GPL (GNU Public License) version 3. This allows for the use of GPL code and any resulting libraries and binaries will be under this license as well. The version 3 flag means you want to upgrade to version 3 of the GPL license.

--enable-static This lets you build static libraries. These are a set of routines and external functions and variables which are resolved at compile-time and copied into your target application to create a stand-alone, executable object file. If you're short on space, you might use a shared library configuration instead.

--disable-debug If you're working on updating FFMPEG directly, you'd want FFMPEG's debugging symbols. But if you just want to use FFMPEG to do something else, you don't need these.

--disable-ffplay This disables building the ffplay build, which is for a media player that uses SDL and the FFMPEG libraries.

--disable-indev=sndio --disable-outdev=sndio Sndio is an audio and MIDI framework that's part of the OpenBSD project. It's most commonly used for Linux. Indev is short for input devices. So this command disables devices using sndio. Outdev disables output devices using sndio. If you're not using OpenBSD, you probably don't have to have these enabled.

--cc=gcc State what compiler you want to use. We already know it's gcc, but here it is configured.

---enable-fontconfig This allows you to configure fonts on your system if need be. XML is used to configure the fonts.

--enable-frei0r frei0r is a cross-platform framework for standard video effects. It offers mixers, filters and generators that you can control through parameters you send in queries to its plugin API. This is one of the libraries FFMPEG relies on.

--enable-gnutls Maybe you already gnu this (see what I did there) but for many tasks, you'll need https support. GnuTLS provides this support if you decided you didnt want to use openssl, libtls or mbedtls.

--enable-gmp Also called the GNU MP Bignum Library this library is used to do arbitrary-precision arithmetic and perform operations on integers, rational numers, and floating-point numbers.

--enable-libgme The Game Music Emu library contains music emulators that let you play back music files from all different kinds of vintage consoles and computer systems. (Sorry, no actual emus.) So basically if you find yourself stuck in the 80s, this is the library for you.

--enable-gray This enables support for grayscale, which is great if you need to rest your eyes or you prefer images that show intensity only and no color.

--enable-libaom If you wanted to work with AV1 this is the codec library for it.

--enable-libfribidi The GNU FriBidi library is used so that you can properly support Arabic and Hebrew alphabets.

--enable-libass The Libass library is a portable subtitle renderer for the ASS/SSA format.

--enable-libvmaf VMAF stands for Video Multimethod Assessment Fusion and it's a video quality metric developed by Netflix with the University of Southern California. It's for predicting subjective video quality based on reference and distorted video sequence. You can use the metric to evaluate the quality of different video codecs, encoders, encoding settings and transmission variants in order to achieve the best performance for your video. The library libvmaf gives you tools for scoring and measuring video quality according to this metric.

--enable-libfreetype The FreeType library enables a wide variety of applications to access contents of font files. It supports bitmap and scalable formats.

--enable-libmp3lame This is for LAME MP3 Encoder, a library for encoding MPEG Audio Layer III, otherwise known as MP3s.

--enable-libopencore-amrnb --enable-libopencore-amrwb libopencore-amrnb is for adaptive, multi-rate speech codecs. It encodes narrowband signals at variable bit rates. libopencore-amrwb is also for this type of codec. Each library handles a different flavor of adaptive, multi-rate speech codec.

--enable-libopenjpeg OpenJPEG is an open source library that lets you encode and decode JPEG 2000 images.

--enable-librubberband Rubber Band Audio Time Stretcher Library allows you stretch audio time and pitch-shift it. It allows you to change the tempo and pitch of an audio stream or recording dynamically.

--enable-libsoxr Libsoxr is a library that's used to perform fast, high-quality, one-dimensional sample rate conversion. This is necessary to prevent changes in speed and pitch of audio that can occur during a transfer of recorded material if a tool like this is not in use.

--enable-libspeex Libspeex is a library for Speex. Speex is an audio codec designed specifically to reproduce human speech. It's free an can be used for VoIP applications and podcasts. It's based on the CELP coding algorithm.

--enable-libsrt Libsrt is a library for an open source video transport protocol called Secure Reliable Transport (SRT). It's UDP based rather than TCP based. The advantage is use of UDP allows for delivery of video across unreliable or dirty networks.

--enable-libvorbis --enable-libopus --enable-libtheora Libvorbis is a library for Vorbis. Vorbis is a free, open-source software project run by Xiph.org Foundation. This project works on an audio coding format and associated encoder/decoder for lossy audio compression. It's usually used with the ogg container format. Libopus is another of the Xiph.org Foundation's lossy audio compression codecs that's designed for speech and general audio. Same deal with libtheora, except it's Xiph's video codec. It's free and it uses lossy compression.

--enable-libvidstab The VidStab library is for video stabilization. It can be used to remove undesirable shakes and jitters.

--enable-libvo-amrwbenc This is the VisualOn AMR-WB encoder library. This library contains an encoder implementation of the Adaptive Multi Rate Wideband (AMR-WB) audio codec. The library is based on a codec implementation by VisualOn as part of the Stagefright framework from the Google Android project.

--enable-libvpx Libvpx is a free software video codec library from Google and the Alliance for Open Media. It serves as the reference software implementation for the VP8 and VP9 video coding formats, and for AV1 a special fork named libaom that was stripped of backwards compatibility.

--enable-libwebp The libwebp contains a library and support programs to encode and decode images in WebP format.

--enable-libx264 libx264 is a software based H.264 encoder.

--enable-libx265 libx265 is a software based H.265 encoder.

--enable-libxml2 libxml2 is a software library for parsing XML documents. It is also the basis for the libxslt library which processes XSLT-1.0 stylesheets.

--enable-libdav1d libdav1d is the fastest AV1 decoder on all platforms.

--enable-libxvid libxvid is an Xvid MPEG-4 Part 2 encoder wrapper.

--enable-libzvbi libzvbi allows libavcodec to decode DVB teletext pages and DVB teletext subtitles. It requires the presence of the libzvbi headers and library during configuration.

--enable-libzimg libzimg is enabled when you want to use the zscale filter. This filter forces the output display aspect ratio to be the same as the input, by changing the output sample aspect ratio.

FFMPEG library versions

This section of output lists the main libraries in FFMPEG and the versions you have installed.

FFMPEG:  libavutil      57.  2.100 / 57.  2.100
  libavcodec     59.  3.102 / 59.  3.102
  libavformat    59.  4.101 / 59.  4.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.103 /  8.  0.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100

FFMPEG input info

This section shows you details about your video live stream.

FFMPEG:Input #0, matroska,webm, from 'pipe:':
  Metadata:
    encoder         : Chrome
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
  Stream #0:1(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 240x240, SAR 1:1 DAR 1:1, 1k tbr, 1k tbn (default)

Here's the first line:

"FFMPEG:Input #0, matroska, webm, from 'pipe:':

This explains how video is being input. We can see here that the multimedia container matroska and the open video format webm is being used to capture video.

"Metadata: encoder : Chrome Duration: N/A, start: 0.000000, bitrate: N/A"

Next, there's more information about the streams being input:

"Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default) Stream #0:1(eng): Video: h264 (Constrained Baseline), yuv420p(progressive),
240x240, SAR 1:1 DAR 1:1, 1k tbr, 1k tbn (default)"

The audio stream

The audio stream is using the opus codec with a sample rate of 48000 Hz, which is standard for digital video files. Mono means the audio is monophonic, meaning all sounds are mixed together in a single channel. And fltp is Planar Floating point format. It's a way of retrieving the sample format for your audio. Sample format information is used to determine how many bits will be in each audio sample. The higher the number of bits per sample in a file, the more data that will be stored in the sample. You can learn more about sample format here: What is Sample Format?

The video stream

The video stream is using the h264 codec with a constrained baseline. The term constrained baseline describes the video stream profile. A profile determines the methods that an encoder can use to generate streams and also describe the methods a decoder is expected to perform in order to decode the stream later. The term 'yuv420p' describes the type of video signal you're using.

YUV is a type of video signal where colors are split into three channels, one for luminance (brightness) which includes green, and two for chrominance (color) which include blue and red in separate channels. 420 describes the chroma subsampling used on the video. Normally, you'd notate this as 4:2:0. It's telling you that the color channels have half the resolution of the luminance channel. If you want to learn a bit more about this way of representing color, see the api.video definition for YCbCr. The term progressive means that the video is in a progressive format, which means that the TBR value (coming up in our discussion) is talking about the frame rate rather than the field rate. There's confusion about both these terms. For the purpose of this walkthrough, let's keep things simple. A progressive video format will use frame rate to describe frames per second. An interlaced video format will use field rate. It takes two fields to show you one image.

240x240 describes the pixels in each frame of video. SAR stands for Sample Aspect Ratio, and it's showing you the ratio between the width and the height of each individual pixel - 1:1. DAR stands for Display Aspect Ratio and that's the ratio between the width and height of a full image in your video. In this case it's also 1:1.

In the final line, it closes out with "1k tbr, 1k tbn (default)." TBR represents the frame rate baseline. This is guessed by FFMPEG when it looks at the video stream. At the start of a video stream, TBR is low. In our stream, it's 1 at the very start. Sometimes if you have a video format that's interlaced, the TBR will be twice as high as expected, because there are two fields used to create an image. TBN represents the time base in AVStream that comes from the container. TBC is the time base for the codec for the stream.

Stream mapping

Next in our information from FFMPEG we have a section about stream mapping that looks like this:

FFMPEG:Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (opus (native) -> aac (native))

Stream #0:1 is our video stream. This means that the input stream is from the first file '0' and it is the second stream in that file '1.' h264 (native) means that the detected codec of the input stream is H.264 and that FFMPEG is going to use the built-in decoder to decode the stream. It's being mapped to h264 (libx264) meaning that the output stream is going to be H.264 and FFMPEG will use the libx264 encoder to generate the stream.

Stream #0:0 is our audio stream. This means that the input stream is from the first file '0 and its the first stream in that file '0.' opus (native) means that the detected audio codec of the input stream is opus and as before, native means that FFMPEG is going to use its built-in decoder for opus to decode the stream. aac (native) means the output audio will be in aac, and FFMPEG will use the built in encoder for aac to generate the stream.

Configuration details for libx264

We're mapping to libx264, so now we receive some details about how libx264 is configured for our stream.

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:VBV bufsize set but maxrate unspecified, ignored

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:using SAR=1/1

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:profile Constrained Baseline, level 3.0, 4:2:0, 8-bit

FFMPEG:[libx264 @ 0x667ea00] 
FFMPEG:264 - core 164 r3065 ae03d92 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=3 sliced_threads=1 slices=3 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=30 keyint_min=16 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=25.0 qcomp=0.60 qpmin=0 qpmax=51 qpstep=4 ip_ratio=1.40 aq=0

You can see the Video Buffering Verifier confirms that there's a buffer size set, but the max bit rate it can handle isn't specified, so it's ignored. Then the SAR is 1:1, as it was to start with. We can see the CPU capabilities available for sending our live stream and that we'll be using the constrained baseline for H.264.

Next there's the line:

"FFMPEG:264 - core 164 r3065 ae03d92 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html"

This tells us what version of the H.264 codec FFMPEG uses. It's followed by options that are configured for the codec.

options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=3 sliced_threads=1 slices=3 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=30 keyint_min=16 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=25.0 qcomp=0.60 qpmin=0 qpmax=51 qpstep=4 ip_ratio=1.40 aq=0

cabac=0 Cabac stands for context-adaptive binary arithmetic coding. It's a type of entropy encoding, which is a lossless data compression technique. H.264 is lossy, so cabac is used at the end to do a final compression that is lossless. You should not mistake its inclusion in H.264's compression steps as meaning all the steps are lossless. Also, explaining this algorithm in detail would take some time. If you want to learn more about cabac, look here: Context=adaptive binary arithmetic coding

ref=1 This indicates which frame will be the first reference frame. Here, it's the first frame.

deblock=0:0:0 This is the deblock filter for H.264. It creates pixelation to help improve the appearance of your video. It's useful when macroblocking occurs, which would be a huge block of pixels that look unnatural. Deblocking blurs these blocks to make them look normal again.

analyse=0:0 This is part of deblocking. It helps determine the size of each block you will apply deblocking to.

me=dia This is saying that the motion estimation method is diamond or dia. Motion estimation is the process of determining motion vectors that describe the transformation from one 2D image to another; usually from adjacent frames in a video sequence. Diamond search technique for block motion estimation is based on diamond search patterns. The process of block matching motion estimation is to find out a candidate block, within a search area in the previous frame, which is most similar to the current block in the present frame. So you're saying here use this technique for motion estimation.

subme=0 This is for the sub-pixel motion estimation method. It's important for video coding inter-frame prediction and has high computation complexity. It's set to 0 meaning there will be zero sub-pixel motion estimation done.

psy=1 psy_rd=1.00:0.00 This is also to do with motion-compensated DCT, which is a lossy block compression transform coding technique. If set to 1 it means use psychovisual optimizations. It means optimizing quantization tables based on the human visual system and humans see. It's a complex topic that can't be fully explained here. psy_rd is about setting how strong the psychovisual optimization will be.

mixed_ref=0 This allows you to use one reference per partition as opposed to per macroblock. A macroblock is a large block of pixels and a partition is a smaller, multiple variable-sized prediction block.

me_range=16 Again about motion estimation, but this time about the range for a motion vector. In video compression, a motion vector is the key element in the motion estimation process. It is used to represent a macroblock in a picture based on the position of this macroblock in another picture, called the reference picture. This parameter lets you set the range.

chroma_me=1 Typically when doing motion estimation, only luminance is examined. You can have chroma considered as well by setting chroma_me to be 1.

trellis=0 This lets you set the rate-distortion optimal quantization. This is a method used to improve video quality in video compression. It optimizes the amount of video quality lost per chunk of data by measuring how far an optimization will deviate from the source material and the cost of that deviation. This can be used to decide what choices are useful vs. resulting in the loss of too much data. It's a slow process, so sometimes it's better not to use it, which is what's being done here by setting trellis=0.

8x8dct=0 With this parameter you can enable adaptive spatial transform. This is a way of altering an image or video frame through rotation, flips, scaling and deformation. For our case, where it's for video, it's about ways to manipulate the block of data so it appears less distorted and of higher quality.

cqm=0 Allows the use of a custom quantization matrix to weight frequencies differently in the quantization process. The presets quant matrices are "jvt" and "flat". Recommended only if you know what you're doing.

deadzone=21,11 When trellis isn't activated, deadzone parameters determine how many DCT coefficients are rounded up or down. Rounding up results in higher quality and more detail retention, but costs more bits--so rounding is a balance between quality and bit cost. Lowering these settings will result in more coefficients being rounded up, and raising the settings will result in more coefficients being rounded down. Recommended: keep them at the defaults. This is part of the settings for rate-distortion optimal quantization. This is again fairly complex to explain. If you want to learn more about it conceptually, check out this page: Quantization

fast_pskip=1 By default, x264 will skip macroblocks in P-frames that don't appear to have changed enough between two frames to justify encoding the difference. This considerably speeds up encoding. However, for a slight quality boost, P-skip can be disabled. In this case, the full analysis will be done on all P-blocks, and the only skips in the output stream will be the blocks whose motion vectors happen to match that of the skip vector and motion vectors happen to match that of the skip vector and which have no residual. The speed cost of enabling no-fast-pskip is relatively high, especially with many reference frames. There is a similar B-skip internal to x264, which is why B-frames generally encode much faster than P-frames, but it cannot be disabled on the commandline.

chroma_qp_offset=0 This stands for chroma quantization parameter offset. It is the quantization parameter difference between chroma and luma.

threads=3 FFMPEG is multi-threaded by default. How many threads it will use depends on the codec. By default for libx264 it is cores x1.5 for frame threads and cores x 1 for slice threads.

lookahead_threads=3 A lookahead thread looks at incoming frames before they are transcoded. Number of lookahead threads can impact performance speed.

sliced_threads=1 Sliced threading decodes multiple parts of a frame at the same time.

slices=3 If the codec you're using supports multi-threading, you can decode more than one part of a single frame at once by working on multiple slices. This is only available if the video was encoded using slices.

nr=0 Confusingly, this stands for noise-sensitivity. You can use it with static-thresh to change the threshold on blocks that are examined in an image. If they fall below the specified threshold the encoder skips them.

decimate=1 This allows you to drop duplicated frames at regular intervals.

interlaced=0 This is a simple interlacing filter from progressive contents. This interleaves upper (or lower) lines from odd frames with lower (or upper) lines from even frames, halving the frame rate and preserving image height.

bluray_compat=0 Configure the encoder to be compatible with the bluray standard. It is a shorthand for setting "bluray-compat=1 force-cfr=1".

constrained_intra=0 You can enable constrained intra prediction, which is required for the base layer of SVC encodes. This is an intra prediction technique where the video encoder limits the use of neighboring blocks as reference blocks in the intra prediction process. If you're using constrained intra prediction, you can configure video to not use neighboring blocks as reference blocks if the neighboring blocks were coded using inter prediction. By not using inter predicted blocks as reference blocks for intra prediction, the video encoder may create an encoded video bitstream that is more error resilient.

bframes=0 You can set the maximum number of concurrent B-frames that x264 can use. Without B-frames, a typical x264 stream has frame types like so: IPPPPP...PI. With --bframes 2, up to two consecutive P-frames can be replaced with B-frames, like: IBPBBPBPPPB...PI. B-frames are similar to P-frames, except they can use motion prediction from future frames as well. This can lead to significantly better efficiency in terms of compression ratio.

weightp=0 Use this to enable use of explicit weighted prediction to improve compression in P-frames. Higher modes are slower.

keyint=30 This sets the maximum interval between IDR-frames (aka keyframes) in x264's output. You can specify "infinite" to never insert non-scenecut IDR-frames. IDR-frames are 'delimiters' in the stream - no frame can reference data from the other side of the IDR-frame. As well as this, IDR-frames are also I-frames, so they don't reference data from any other frame. This means they can be used as seek points in a video.

keyint_min=16 This sets the minimum length between IDR-frames. Very small keyint ranges can cause "incorrect" IDR-frame placement (for example, a strobing scene). This option limits the minimum length in frames after each IDR-frame before another can be placed.

scenecut=0 This sets the threshold for I/IDR frame placement (read: scene change detection). x264 calculates a metric for every frame to estimate how different it is from the previous frame. If the value is lower than scenecut, a 'scenecut' is detected. An I-frame is placed if it has been less than keyint_min frames since the last IDR-frame, otherwise an IDR-frame is placed. Higher values of scenecut increase the number of scenecuts detected.

intra_refresh=0 You can disable IDR-frames, instead H.264 uses intra coding for each macroblock in the frame every keyint_min frames. Blocks are refreshed in a horizontally scrolling column - the 'refresh wave'. This benefits low-latency streaming by making it possible to achieve more constant frame sizes than is possible with standard IDR-frames. It also increases the resilience of the video stream to packet loss. This option does reduce compression efficiency, hence only use it when needed.

rc=crf rc stands for Rate Control. You can adjust the file data rate in several ways, the option shown here is CRF, or Constant Rate Factor. CRF is an encoding mode that adjusts the file data rate up or down to achieve a selected quality level rather than a specific data rate. CRF values range from 0 to 51, with lower numbers delivering higher quality scores.

mbtree=0 This stands for macroblock tree rate control. Macroblock tree rate control improves compression by tracking how long different parts of an image last across frames. For parts of an image that stay the same, you don't need to continually save that data, only make a note that it continues to be there so you can use that as a reference to reconstruct that part of the frame later.

crf=25.0 This is related to the rc=crf command. CRF is an encoding mode that adjusts the file data rate up or down to achieve a selected quality level rather than a specific data rate. CRF values range from 0 to 51, with lower numbers delivering higher quality scores.

qcomp=0.60 The default setting is 0.60. qcomp stands for quantizer curve compression factor. A setting of 0 will give you a constant bitrate while a setting of 1 will give you a constant quantizer. This can be combined with mbtree, but the higher your qcomp setting, the weaker the effect of the mbtree setting.

qpmin=0 The default setting for this is 0 and raising this minimum is discouraged because it can negatively impact the quality of background areas in your frame. qpmin defines the minimum quantizer that H.264 will ever use. The lower the quantizer, the closer the output is to the input.

qpmax=51 The default setting for qpmax is 51. The default of 51 is the highest quantizer available for use in the H.264 spec, and is extremely low quality. This default disables qpmax. You can set this as low as the 30-40 range if you want to cap the minimum quality x264 can output, but adjusting it is not recommended.

qpstep=4 This allows you to set the maximum change in the quantizer between two frames.

ip_ratio=1.40 The default setting is 1.40. You can change the average decrease in quantizer for B-frames vs. P-frames, with higher values decreasing B-frame quality.

aq=0 aq stands for Adaptive Quantization. This helps distribute bits between macroblocks in your video. If you don't use it, it can underallocate bits to sections that lack detail. A setting of 0, as with other FFMPEG settings, means you will not use it at all.

Output to api.video

Now that you've got all the configuration settings for your streams and you've mapped them, you'll want to see some details about what will be output to your destination.

FFMPEG:Output #0, flv, to 'rtmp://broadcast.api.video/s/30087931-221e-43cf-b5f9-e91bcc1f7332':
FFMPEG:  Metadata:

FFMPEG:    encoder         : 
FFMPEG:Lavf59.4.101
FFMPEG:

FFMPEG:  Stream #0:0
FFMPEG:(eng)
FFMPEG:: Video: h264 ([7][0][0][0] / 0x0007), yuv420p(progressive), 240x240 [SAR 1:1 DAR 1:1], q=2-31
FFMPEG:, 
FFMPEG:15 fps, 
FFMPEG:1k tbn
FFMPEG: (default)
FFMPEG:

FFMPEG:    Metadata:

FFMPEG:      encoder         : 
FFMPEG:Lavc59.3.102 libx264
FFMPEG:

FFMPEG:    Side data:

FFMPEG:      
FFMPEG:cpb: 
FFMPEG:bitrate max/min/avg: 0/0/0 buffer size: 5000 
FFMPEG:vbv_delay: N/A
FFMPEG:

FFMPEG:  Stream #0:1
FFMPEG:(eng)
FFMPEG:: Audio: aac (LC) ([10][0][0][0] / 0x000A), 22050 Hz, mono, fltp, 22 kb/s
FFMPEG: (default)
FFMPEG:

FFMPEG:    Metadata:

FFMPEG:      encoder         : 
FFMPEG:Lavc59.3.102 aac
FFMPEG:

Here you can see the destination, shown by the stream key and then a summary of details about your video and audio streams. The encoders being used are listed as well. We don't need to walk through everything listed here because we covered it in the earlier sections when we mapped the video and audio streams. FPS is frames per second.

Now we can take a look at the lines that show us details about each chunk of data being streamed. Here's one of the lines:

"FFMPEG:frame=65 fps= 55 q=12.0 size=29kB time=00:00:05.06 bitrate= 47.1kbits/s speed=4.26x"

The line is a snapshot where everything that is happening at that moment is reported to the terminal. It says that in this moment, you're streaming frame 65. The frames per second is 55, and the quality (q) is 12. The lower the number for quality, the better the video. The higher the number, the worse. The size of the chunk of data being streamed is also listed in kB with size. The time is the time from when the live stream started, and the bitrate is how many kbits per second yu're streaming. speed is how fast everything is streaming.

Conclusion

While this guide doesn't tell you everything about all concepts (for example quantization, which is too complicated to include in this post) I hope that this walkthrough helped explain what things are a bit more. To help you further, I've added a list of some guides that can help you find information about the various commands we went over today.

Resources

Here are some key resources to help you do more with the commands you learned here.

Erikka Innes

Developer Evangelist

Connect your users with videos

Create a free account today