FFMPEG stream from sdp to youtube/facebook live(RTMP) - ffmpeg

Similar to this question, I'm trying to stream to Youtube/Facebook live (rtmp) via Ffmpeg.
The server on which ffmpeg is installed receives a rtp stream (source of the stream uses Vp8 and opus as the codecs), i then use the sdp given below as input for the ffmpeg command
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=FFMPEG Test
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 56.15.102
m=audio 10004 RTP/AVP 111
a=rtpmap:111 OPUS/48000/2
m=video 10006 RTP/AVP 100
a=rtpmap:100 VP8/90000
a=fmtp:100 packetization-mode=1
Where 10004 and 10006 are the audio and video port of the rtp input stream.
I'm using the following FFMPEG command to stream to youtube/facebook live
ffmpeg -protocol_whitelist file,crypto,udp,rtp -i input.sdp -c:a aac -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv "rtmp_url"
Log:
ffmpeg version 4.2.2-1build1~18.04.sav0 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/usr --extra-version='1build1~18.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[sdp # 0x56083912d340] Could not find codec parameters for stream 1 (Video: vp8, yuv420p): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, sdp, from 'input.sdp':
Metadata:
title : FFMPEG Test
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Stream #0:1: Video: vp8, yuv420p, 90k tbr, 90k tbn, 90k tbc
Codec AVOption profile () specified for output file #0 (youtube_rtmp_url) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption g (set the group of picture (GOP) size) specified for output file #0 (youtube_rtmp_url) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption preset (Configuration preset) specified for output file #0 (youtube_rtmp_url) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
Stream #0:0 -> #0:0 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, flv, to 'youtube_rtmp_url':
Metadata:
title : FFMPEG Test
encoder : Lavf58.29.100
Stream #0:0: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.54.100 aac
av_interleaved_write_frame(): Broken pipe 134.5kbits/s speed=2.35x
[flv # 0x5608391a7040] Failed to update header with correct duration.
[flv # 0x5608391a7040] Failed to update header with correct filesize.
Error writing trailer of youtube_rtmp_url: Broken pipe
size= 162kB time=00:00:09.86 bitrate= 134.2kbits/s speed=2.32x
video:0kB audio:155kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.493091%
[aac # 0x5608391a7ac0] Qavg: 247.499
Conversion failed!
I have verified that ffmpeg can read the stream, i used a different ffmpeg command to record the stream and that works well. Could someone please point out whats wrong or link to some documentation that might help?

Related

How to make ffmpeg re-encode an vp9 webm with alpha into a vp9 webm with alpha

I am trying to find optimal parameters for encoding a transparent video using ffmpeg in my scenario, and as a test, I have been re-encoding a pre-made transparent .webm (vp9 with alpha channel, made using python vidgear) like this:
$ /usr/bin/ffmpeg -i pre-made.webm pre-made-remade.webm
ffmpeg version 4.3.2-0york0~18.04 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version='0york0~18.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libzimg --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, matroska,webm, from 'pre-made.webm':
Metadata:
ENCODER : Lavf58.45.100
Duration: 00:01:11.04, start: 0.000000, bitrate: 1107 kb/s
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 1514x1910, SAR 1:1 DAR 757:955, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
Metadata:
alpha_mode : 1
ENCODER : Lavc58.91.100 libvpx-vp9
DURATION : 00:01:11.040000000
Stream mapping:
Stream #0:0 -> #0:0 (vp9 (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 # 0x55927254b0c0] v1.7.0
[libvpx-vp9 # 0x55927254b0c0] Neither bitrate nor constrained quality specified, using default CRF of 32
Output #0, webm, to 'pre-made-remade.webm':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p, 1514x1910 [SAR 1:1 DAR 757:955], q=-1--1, 25 fps, 1k tbn, 25 tbc (default)
Metadata:
alpha_mode : 1
DURATION : 00:01:11.040000000
encoder : Lavc58.91.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 1776 fps=8.9 q=0.0 Lsize= 6159kB time=00:01:11.00 bitrate= 710.6kbits/s speed=0.354x
video:6146kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.214488%
According to the ffmpeg logs, the libvpx-vp9 is correctly being chosen, and alpha_mode is 1, which bodes well.
However, when actually viewing the video, the video is no longer trasparent.
How could I force ffmpeg to keep the alpha channel when re-encoding the video? (This also applies when trying to merge audio into the .webm)
Bonus question: what arguments do you recommend for efficient vp9 encoding? I have tried using -threads 16 -speed 4 -tile-columns 6 -frame-parallel 1 -row-mt 1 but it seems to fail at fully utilizing all my CPU cores when encoding with the alpha channel (when piping frames from my python script).
See the line
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv) ...
The yuv420p indicates that ffmpeg hasn't detected alpha in the input, else it would be yuva420p. To export alpha from VP9 streams, you need to use libvpx decoders, so
ffmpeg -c:v libvpx-vp9 -i pre-made.webm ...

.avi file to .webm file with alpha channel

I have no idea how to use FFmpeg, but my .avi file is too large for a 2-second video? Any idea how I can convert it to WebM? While retaining its alpha channel?
I tried this:
ffmpeg -i "1.avi" -c:v libvpx -pix_fmt yuva420p "1.webm"
Output showed:
ffmpeg version 4.4-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[avi # 00000245f2e7d640] Stream #0: not enough frames to estimate rate; consider increasing probesize
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from '1.avi':
Duration: 00:00:02.00, start: 0.000000, bitrate: 3983150 kb/s
Stream #0:0: Video: rawvideo, bgra, 1920x1080, 4014784 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> vp8 (libvpx))
Stream #0:1 -> #0:1 (pcm_s16le (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libvpx # 00000245f2e8ecc0] v1.10.0-24-g8b3e575a4
[libvpx # 00000245f2e8ecc0] Neither bitrate nor constrained quality specified, using default CRF of 32 and bitrate of 256kbit/sec
[libvpx # 00000245f2e8ecc0] Transparency encoding with auto_alt_ref does not work
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Simplest command is:
ffmpeg -i input.avi output.webm
The video encoder libvpx-vp9 will be used by default.
libvpx-vp9 supports alpha, so alpha will be preserved by default.
For more info see FFmpeg Wiki: VP9.
Command I used to solve:
ffmpeg -i "1.avi" -c:v libvpx -b:v 2000k -pix_fmt yuva420p -auto-alt-ref 0 "1.webm"
"1.avi" - input.avi
"1.webm" - out.webm
Simple command:
ffmpeg -i input.avi output.webm

Concatenate YUVs to generate output YUV using FFMPEG

I have 10 yuv input and each yuv is a frame of WxH (ip0_WxH.yuv, ip1_WxH.yuv, ..., ip9_WxH.yuv)
I need to concatenate all 10 to create a final yuv output with all 10 frames in this.
Option 1:
I used below link to do so. But final yuv output is not proper from frame number 2 onwards.
Only first frame looks good. From frame number 2, the buffer address of chroma and luma has may be some wrong indexing and hence the display of the picture is wrong.
Converting more yuv frames to one yuv frame
cat *.yuv > movie.yuv
Option 2:
I tried to use FFMPEG to concatenate the yuvs together : https://trac.ffmpeg.org/wiki/Concatenate
$ cat mylist.txt
file 'ip0_WxH.yuv'
file 'ip1_WxH.yuv'
file 'ip2_WxH.yuv'
Desktop/danny$ ffmpeg -f rawvideo -f concat -safe 0 -i myfile.txt -c out.yuv
but got this error:
...
Trailing options were found on the commandline.
[IMGUTILS # 0x7fff4d92d720] Picture size 0x0 is invalid
[concat # 0x558b6c335900] Impossible to open 'ip0_WxH.yuv'
myfile.txt: Invalid argument
Can any one suggest the ffmpeg command to concatenate these YUVs together.
UPDATE:
As per the first answer suggested by llogan,
I used below command:
ffmpeg -f image2 -c:v rawvideo -pixel_format rgb24 -video_size 1344x968 -i ip%d_WxH.yuv output.yuv
Output
~/Desktop/danny$ ffmpeg -f image2 -c:v rawvideo -pixel_format rgb24 -video_size 1344x968 -i ip%d_WxH.yuv output.yuv
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, image2, from ' ip%d_WxH.yuv':
Duration: 00:00:00.16, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1344x968, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[rawvideo # 0x5623405f30c0] Invalid buffer size, packet size 2132928 < expected frame_size 3902976
Error while decoding stream #0:0: Invalid argument
[rawvideo # 0x5623405f30c0] Invalid buffer size, packet size 2132928 < expected frame_size 3902976
Error while decoding stream #0:0: Invalid argument
[rawvideo # 0x5623405f30c0] Invalid buffer size, packet size 2132928 < expected frame_size 3902976
Error while decoding stream #0:0: Invalid argument
[rawvideo # 0x5623405f30c0] Invalid buffer size, packet size 2132928 < expected frame_size 3902976
Error while decoding stream #0:0: Invalid argument
Finishing stream 0:0 without any data written to it.
Output #0, rawvideo, to 'output.yuv':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1344x968, q=2-31, 780595 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 rawvideo
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
Conversion failed!
Try different yuvformat.
As you are using yuv. So use either yuv422p or yuv420p depends upon your input yuv type.
Try this :
ffmpeg -f image2 -c:v rawvideo -pixel_format yuv420p -video_size 1344x968 -i ip%d_WxH.yuv out.yuv

ffmpeg sRGB jpgs to rec709 mov

I'm trying to convert an sRGB jpeg sequence into a rec709 DnX Quicktime... but struggle to get the colormatrix right.
ffmpeg -y -f image2 -start_number 1 -framerate 24 -i input.%04d.jpg -c:v dnxhd -vf "scale=1920:1080,fps=24,format=yuv422p10,colorspace=all=bt709:itrc=srgb" -b:v 175M -c:a pcm_s16le output.mov
My understanding is this should set everything to rec709, but override the input response curve (itrc=srgb), but this fails with
Unsupported input primaries 2 (unknown)
Error while filtering: Invalid argument
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
I haven't been able to come up with any combination of flags that doesn't trough an error and produces the right colors.
Some docs here: ffmpeg filters trc
Any help much appreciated!
Edit:
Full log:
$ ffmpeg -y -f image2 -start_number 1 -framerate 24 -i input.%04d.jpg -c:v dnxhd -vf "scale=1920:1080,fps=24,format=yuv422p10,colorspace=all=bt709:itrc=srgb" -b:v 175M -c:a pcm_s16le output.mov
ffmpeg version 4.3.1-2020-11-08-essentials_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --en
able-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-li
bmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, image2, from 'input.%04d.jpg':
Duration: 00:00:00.13, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1200:1200 DAR 16:9], 24 fps, 24 tbr, 24 tbn, 24 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> dnxhd (native))
Press [q] to stop, [?] for help
[swscaler # 0000026ac0f81600] deprecated pixel format used, make sure you did set range correctly
Output #0, mov, to 'output.mov':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p10le, 1920x1080 [SAR 1:1 DAR 16:9], q=2-1024, 175000 kb/s, 24 fps, 12288 tbn, 24 tbc
Metadata:
encoder : Lavc58.91.100 dnxhd
[Parsed_colorspace_3 # 0000026ac0f7e080] Unsupported input primaries 2 (unknown)
Error while filtering: Invalid argument
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

ffmpeg error MPEG-1/2 does not support 3/1 fps

Im trying to broadcast my desktop to web page via ffserver but Im getting this error
MPEG-1/2 does not support 3/1 fps
Error initializing output stream 0:1 -- Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
Here is my cli
ffmpeg -probesize 1000M -framerate 30 -video_size 1680x1050 -f x11grab -i :0.0 -f alsa -i default -c:a aac -vf format=yuv420p http://localhost:8090/feed1.ffm
And here is whole log
ffmpeg -probesize 1000M -framerate 30 -video_size 1680x1050 -f x11grab -i :0.0 -f alsa -i default -c:a aac -vf format=yuv420p http://localhost:8090/feed1.ffm
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, x11grab, from ':0.0':
Duration: N/A, start: 1606681865.700480, bitrate: N/A
Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1680x1050, 30 fps, 1000k tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'default':
Duration: N/A, start: 1606681866.175206, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #1:0 -> #0:0 (pcm_s16le (native) -> mp2 (native))
Stream #0:0 -> #0:1 (rawvideo (native) -> mpeg1video (native))
Stream #0:0 -> #0:2 (rawvideo (native) -> vp8 (libvpx))
Press [q] to stop, [?] for help
[x11grab # 0x55d455855a00] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[mpeg1video # 0x55d455889040] bitrate tolerance 21333 too small for bitrate 64000, overriding
[mpeg1video # 0x55d455889040] MPEG-1/2 does not support 3/1 fps
Error initializing output stream 0:1 -- Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
[alsa # 0x55d45585ec40] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Conversion failed!
Contents of ffserver.conf:
HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 1g
ACL allow 127.0.0.1
ACL allow localhost #ovaj
</Feed>
<Stream test1.mpg>
Feed feed1.ffm
Format mpeg
AudioBitRate 32
AudioChannels 1
AudioSampleRate 44100
VideoBitRate 64
VideoBufferSize 40
VideoFrameRate 3
VideoSize 160x128
VideoGopSize 12
</Stream>
<Stream feed.webm>
Format webm
Feed feed1.ffm
VideoCodec libvpx
VideoSize 320x240
VideoFrameRate 15
VideoBitRate 512
VideoBufferSize 512
NoAudio
AVOptionVideo flags +global_header
StartSendOnKey
</Stream>
<Stream stat.html>
Format status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
</Stream>
The encoder mpeg1video does not support a fame rate of 3, but you set VideoFrameRate 3 in ffserver.conf. mpeg1video is the default encoder used for mpeg format unless you tell it otherwise.
Use a supported frame rate if you want to use mpeg1video.
See ffmpeg -h encoder=mpeg1video for a list of supported frame rates.

Resources