Search code examples
youtubeffmpeglive-streamingip-camera

How to Live Stream YouTube without Audio


I have two IP cam and a computer with ffmpeg to re-stream them to YouTube.

First Cam

It has Video and Audio. I can re-stream to YouTube successfully with this command.

ffmpeg -re -rtsp_transport tcp -i rtsp://192.168.aaa.bbb:554/ch0_1.h264 -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 400k -maxrate 800k -deinterlace -vcodec libx264 -preset medium -g 30 -r 30 -f flv rtmp://a.rtmp.youtube.com/live2/<YouTube_key>

Second Cam

It has Video only. However, with both commands below, I can't stream to YouTube. (although the ffmpeg process is running well)

ffmpeg -re -rtsp_transport tcp -i rtsp://192.168.aaa.ccc/Streaming/Channels/102 -an -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 400k -maxrate 800k -deinterlace -vcodec libx264 -preset medium -g 30 -r 30 -f flv rtmp://a.rtmp.youtube.com/live2/<YouTube_key>

or

ffmpeg -re -rtsp_transport tcp -i rtsp://192.168.aaa.ccc/Streaming/Channels/102 -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 400k -maxrate 800k -deinterlace -vcodec libx264 -preset medium -g 30 -r 30 -f flv rtmp://a.rtmp.youtube.com/live2/<YouTube_key>

I've test both camera's stream first using FLV, and they work well. So, the issue is not the URL of IP camera.

From what I understand, YouTube define stream as audio-video content. However, what if the source only has Video.

So, my question:

How to live stream YouTube without audio, specially from an IP cam?

Thanks


Solution

  • Generate a dummy audio and try

    ffmpeg -re -rtsp_transport tcp -i rtsp://192.168.aaa.ccc/Streaming/Channels/102
           -f lavfi -i anullsrc
           -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 400k -maxrate 800k
           -deinterlace -vcodec libx264 -preset medium -g 30 -r 30
           -acodec libmp3lame -ar 44100 -b:a 128k
           -f flv rtmp://a.rtmp.youtube.com/live2/<YouTube_key>