我正在尝试将视频广播到Vimeo通过使用ffmpeg
从无头 Linux 进行广播。看起来我可以广播并且视频没有问题,但是当我看到分析器时,接收比特率不稳定。
尽管如此,ffmpeg
始终报告稳定的比特率。
ffmpeg version 5.0-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev5, 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 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie.mp4':
Metadata:
major_brand : dash
minor_version : 0
compatible_brands: dashmp42iso6
Duration: 00:06:00.00, start: 0.000000, bitrate: 5278 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080, 80 kb/s, 30 fps, 30 tbr, 16k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 4 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/0y52-fczy-u0q4-ektt-a0pu':
Metadata:
major_brand : dash
minor_version : 0
compatible_brands: dashmp42iso6
encoder : Lavf59.16.100
Stream #0:0(und): Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=2-31, 80 kb/s, 30 fps, 30 tbr, 1k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1(und): Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 4 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 329 fps= 30 q=-1.0 size= 6644kB time=00:00:10.86 bitrate=5008.3kbits/s speed= 1x
如果我使用 OBS 从我的笔记本电脑播放视频,分析器会显示稳定的连接。
这是我尝试过的命令。有什么问题吗?
ffmpeg -re -i <VIDEO_FILE> -codec copy -threads 4 -f flv <STREAMING_URL>/<STREAMING_KEY>
答案1
感谢 Gyan 的评论
流媒体通常喜欢恒定比特率。您的命令是复制视频,因此只有当源流是 CBR 时,它才会是 CBR。OBS 正在重新编码。
我发现问题出在源视频方面。所以我决定每次都手动对源视频进行 CBR 编码。在我的用例中,这并不麻烦。