

Click reveal and put this key where it says YOUTUBESTREAMKEY in the script above. To get your YouTube Live stream key go to the live dashboard, at the bottom of the page in the encoder setup tab you will find it. A good rule of thumb is to try the same of down to half of -b:v. FFmpeg Live Stream - Loop Video 1 FFMPEG resize video not working in browser or IOS 2 Piping pis opencv.
#Ffmpeg mp4 live streaming how to#
Setting this value at something adequate such as 2 Megabits means if networks issues occur. How to concatenate two MP4 files using FFmpeg. Following is the FFmpeg command to encode the video and transfer it to the server. The lower -bufsize means your stream has potential to be dropping inbetween low and high quality every second. We would be using FFmpeg to encode and send data to the server. You can also set the bitrate max and min with: -maxrate and -minrate.

It wont be exactly 2 Megabits all the time but will be close, this is dependent on the -bufsize. Adjusting this will be dependent on your upload speed and the original quality of the video you are streaming. b:v 2m is the target bitrate which is 2 Megabits (2,000 Kbps). Below is the list.

If you are not aware in what extensions the HLS formatted video output files are generated. YOURVIDEO.mp4 is the video that will be streamed, make sure you change it to your video file, including and depending on its location (/folder/anotherfolder/video.mp4 etc). Now that ffmpeg is installed and ready to be used, we can now start encoding a sample video input.mp4 to HLS format using below command. ffmpeg -re -i YOURVIDEO.mp4 -c:v libx264 -b:v 2M -c:a copy -strict -2 -flags +global_header -bsf:a aac_adtstoasc -bufsize 2100k -f flv rtmp://a./live2/YOUTUBESTREAMKEY My post about restreaming an m3u8 link to YouTube Live can be found here. Read the docs to learn more and/or understand the commands used. There are many configuration options but here is what i found works best. Here is a method to live stream a mp4 video file to YouTube with FFmpeg.
