Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
700 views
in Technique[技术] by (71.8m points)

streaming to youtube with ffmpeg

I am trying to stream to youtube but the stream health says no data.

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 is shown rendering frames like this:

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  

but as far as youtube, no data is being sent over.

What is causing this to fail?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Loop the image (-loop 1) at read it at real-time (-re) instead of as fast as possible:

-loop 1 -re -i /tmp/thumbs/thumbnail.jpg 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...