1

I have tried many codes but not one was fit for my needs so i am asking now for help, i have a video that i want to stream (with no audio on it) and desktop audio from the Pi (running Ubuntu Mate 16.04) as i would play the mp3's on vlc (or any other sugestions are welcome as i would use vlc only because it has repeat and shufle)

The kids radio stream is already live but as its a non profit project my Desktop windows mashine is eating to much money by running 24/7 so i got me the Pi3b+ for this job.

Thanks in advance

Ivan

Happy Pi Owner

  • update with this code i got the stream running with low CPU usage : $ ffmpeg -re -stream_loop -1 -i /home/pi/Documents/Youtube/video.mp4 -c copy -f flv -max_muxing_queue_size 400 rtmp://a.rtmp.youtube.com/live2/pfjd-jhjs-k3td-XXXX will try to implement the desktop audio now... – Ivan Bombash Stokic Mar 14 '19 at 11:39
  • You could try pavucontrol if you're using pulseaudio. – llogan Mar 14 '19 at 17:33
  • have pavucontrol installed but cant get the code to run... – Ivan Bombash Stokic Mar 14 '19 at 20:33
  • ffmpeg -re -stream_loop -1 -f pulse -i default -y flv -ar 11025 -acodec libmp3lame -ab 320k ouput.mp3 -stream_loop -1 -i /home/pi/Documents/Youtube/video.mp4 -c copy -f flv -max_muxing_queue_size 400 rtmp://a.rtmp.youtube.com/live2/pfjd-jhjs-k3td-XXXX and i get this error [NULL @ 0x12e7c20] Unable to find a suitable output format for 'flv' flv: Invalid argument – Ivan Bombash Stokic Mar 14 '19 at 20:34
  • Try ffmpeg -re -stream_loop -1 -i /home/pi/Documents/Youtube/video.mp4 -f pulse -i default -c:v copy -c:a aac -f flv -max_muxing_queue_size 400 rtmp://a.rtmp.youtube.com/live2/pfjd-jhjs-k3td-XXXX – llogan Mar 14 '19 at 20:44
  • Thanks for the fast answer, No errors but no sound on youtube, any idea? Here is a SS https://imgur.com/a/VcRAE3m – Ivan Bombash Stokic Mar 14 '19 at 21:02
  • Also have the same issue (forgot to mention it) with the loop not working stoped after video ended... Here is the result. [pulse @ 0x10b9980] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8) frame= 2144 fps= 30 q=-1.0 Lsize= 4295kB time=00:01:12.26 bitrate= 486.9kbits/s speed= 1x
    video:4182kB audio:18kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.237897% [aac @ 0xfbbd60] Qavg: 65536.000
    – Ivan Bombash Stokic Mar 14 '19 at 21:06
  • UPDATED CODE: '' ffmpeg -f pulse -i default -re -stream_loop -1 -i /home/pi/Documents/Youtube/video.mp4 -c copy -fflags +genpts -c:a aac -f flv -max_muxing_queue_size 400 rtmp://a.rtmp.youtube.com/live2/pfjd-jhjs-k3td-XXXX''

    Stream works, video file and desktop audio is streaming just cant get the video file to loop any ideas? ffmpeg version 3.2.12

    – Ivan Bombash Stokic Mar 16 '19 at 11:06
  • Upgrade your ffmpeg. – llogan Mar 18 '19 at 17:15
  • Update fixed the issue, needed to compile new ffmpeg with alsa support. – Ivan Bombash Stokic Mar 18 '19 at 19:52
  • I got it to auto start on boot (if power failure), but i have one more barrier i cant find out how to do it, that is if the internet connection drops and ffmpeg stream stops how to reconnect it automatically? ffmpeg -re -f alsa -i default -re -stream_loop -1 -i "/home/pi/Documents/Youtube/video720p.mp4" -c:v copy -c:a aac -f flv -max_muxing_queue_size 400 rtmp://a.rtmp.youtube.com/live2/pfjd-jhjs-k3td-xxx – Ivan Bombash Stokic Mar 18 '19 at 22:05
  • Since you found a solution to the original question I recommend making an answer here that addresses that original question. The "how to reconnect it automatically" should be a new question. – llogan Mar 18 '19 at 22:25

1 Answers1

1

Streaming the file in a loop with desktop audio to youtube works. Thanks to all!

ffmpeg -re -f alsa -i default -re -stream_loop -1 -i "/home/pi/Documents/Youtube/video720p.mp4" -c:v copy -c:a aac -f flv -max_muxing_queue_size 400 rtmp://a.rtmp.youtube.com/live2/pfjd-jhjs-k3td-xxxx

ffmpeg version 4.1, if you have a older ffmpeg version the loop command may not work...