使用 ffmpeg 流式传输到 youtube
streaming to youtube with ffmpeg
我正在尝试流式传输到 YouTube,但流式传输运行状况显示没有数据。
ffmpeg -threads:v 2 -threads:a 8 -filter_threads 2 -thread_queue_size 512 \
-i /tmp/thumbs/thumbnail.jpg \
-stream_loop -1 \
-i /tmp/audio/tracks.mp3 \
-filter:v "crop=in_w/2:in_h/2:1920:1280" \
-pix_fmt yuv420p -c:v libx264 -qp:v 19 -profile:v high -rc:v cbr_ld_hq -level:v 4.2 -r:v 60 -g:v 120 -bf:v 3 -refs:v 16 -preset fast -f flv rtmp://a.rtmp.youtube.com/live2/xxx
ffmpeg 显示的渲染帧如下:
frame= 1 fps=0.0 q=0.0 size= 236220kB time=04:02:50.73 bitrate= 132.8kbits/s speed=67.3x
frame= 1 fps=0.0 q=0.0 size= 236872kB time=04:03:30.90 bitrate= 132.8kbits/s speed=67.3x
frame= 1 fps=0.0 q=0.0 size= 237539kB time=04:04:12.02 bitrate= 132.8kbits/s speed=67.3x
frame= 1 fps=0.0 q=0.0 size= 238215kB time=04:04:53.69 bitrate= 132.8kbits/s speed=67.4x
frame= 1 fps=0.0 q=0.0 size= 238869kB time=04:05:34.05 bitrate= 132.8kbits/s speed=67.4x
frame= 1 fps=0.0 q=0.0 size= 239515kB time=04:06:13.83 bitrate= 132.8kbits/s speed=67.4x
frame= 1 fps=0.0 q=0.0 size= 240153kB time=04:06:53.14 bitrate= 132.8kbits/s speed=67.5x
但是就 youtube 而言,没有数据被发送过来。
导致失败的原因是什么?
循环图像 (-loop 1
) 实时读取 (-re
) 而不是尽可能快地读取:
-loop 1 -re -i /tmp/thumbs/thumbnail.jpg \
我正在尝试流式传输到 YouTube,但流式传输运行状况显示没有数据。
ffmpeg -threads:v 2 -threads:a 8 -filter_threads 2 -thread_queue_size 512 \
-i /tmp/thumbs/thumbnail.jpg \
-stream_loop -1 \
-i /tmp/audio/tracks.mp3 \
-filter:v "crop=in_w/2:in_h/2:1920:1280" \
-pix_fmt yuv420p -c:v libx264 -qp:v 19 -profile:v high -rc:v cbr_ld_hq -level:v 4.2 -r:v 60 -g:v 120 -bf:v 3 -refs:v 16 -preset fast -f flv rtmp://a.rtmp.youtube.com/live2/xxx
ffmpeg 显示的渲染帧如下:
frame= 1 fps=0.0 q=0.0 size= 236220kB time=04:02:50.73 bitrate= 132.8kbits/s speed=67.3x
frame= 1 fps=0.0 q=0.0 size= 236872kB time=04:03:30.90 bitrate= 132.8kbits/s speed=67.3x
frame= 1 fps=0.0 q=0.0 size= 237539kB time=04:04:12.02 bitrate= 132.8kbits/s speed=67.3x
frame= 1 fps=0.0 q=0.0 size= 238215kB time=04:04:53.69 bitrate= 132.8kbits/s speed=67.4x
frame= 1 fps=0.0 q=0.0 size= 238869kB time=04:05:34.05 bitrate= 132.8kbits/s speed=67.4x
frame= 1 fps=0.0 q=0.0 size= 239515kB time=04:06:13.83 bitrate= 132.8kbits/s speed=67.4x
frame= 1 fps=0.0 q=0.0 size= 240153kB time=04:06:53.14 bitrate= 132.8kbits/s speed=67.5x
但是就 youtube 而言,没有数据被发送过来。
导致失败的原因是什么?
循环图像 (-loop 1
) 实时读取 (-re
) 而不是尽可能快地读取:
-loop 1 -re -i /tmp/thumbs/thumbnail.jpg \