Hello Minex Tuts team, I’ve been trying to find a solution to do a live stream radio 24/7 on my channel for a few days. I’ve already seen two other articles here on how to do this with a single video file and also with a video and audio file separately, however what I really need to do is a stream of several audios with the concat function and an image of static video. I got this code from somewhere on the internet (I don’t remember where) and tried to make an adaptation with the code you already have here, but I was not successful. can you help me?
Here is the code spoken:
#! / bin / bash
VBR = “1500k”
SPF = “25”
QUAL = “ultrafast”
YOUTUBE_URL = “rtmp: //a.rtmp.youtube.com/live2”
YOUTUBE_KEY = “xxxx-xxxx-xxxx-xxxx-xxxx”
VIDEO_SOURCE = “/ home / ubuntu / Video / live1.mp4”
AUDIO_ENCODER = “aac”
ffmpeg \
-stream_loop -1 \
-re \
-i “$ VIDEO_SOURCE” \
-thread_queue_size 512 \
-stream_loop -1 \
-re \
-f concat -i audiofiles.txt \
-c: v libx264 -preset $ QUAL -r $ FPS -g $ (($ FPS * 2)) -b: v $ VBR -bufsize 3000k -maxrate $ VBR \
-c: a $ AUDIO_ENCODER -ar 44100 -b: a 128k -pix_fmt yuv420p \
-f flv $ YOUTUBE_URL / $ YOUTUBE_KEY
The question I have is: where should I keep this file “audiofiles.txt”, in the root of the user “ubuntu” or in the folder that contains the songs for example “/home/ubuntu/music/audiofiles.txt”?
If you can help I will be very grateful, you have already achieved much bigger things and are very good at it!
A hug from Brazil!
Hi there, to successfully streaming a radio on YouTube you have to create a radio server first. I will upload a video probably in next week how to create a 27x7 radio channel on YouTube. You will resolve the problem there. Thank you. MineX Tuts
Hi there, to successfully streaming a radio on YouTube you have to create a radio server first. I will upload a video probably in next week how to create a 27×7 radio channel on YouTube. You will resolve the problem there.
Thank you.
MineX Tuts
See lessMuch obliged! If possible, that this tutorial teaches you how to do something with a radio server via code, just like the first video you posted on YouTube, it was a lot of inspiration for me!
Much obliged! If possible, that this tutorial teaches you how to do something with a radio server via code, just like the first video you posted on YouTube, it was a lot of inspiration for me!
See lessThank You so much for sharing this. It is great help to others.
Thank You so much for sharing this. It is great help to others.
See lessHello, i found this best article on internet but there is one problem that i can't understand about a path error even though i have checked many times. please take a look and help me. [email protected]:~# #! /bin/bash [email protected]:~# VBR="2500k" [email protected]:~# FPS="30" [email protected]:~# QUAL="veryRead more
Hello,
i found this best article on internet but there is one problem that i can't understand about a path error even though i have checked many times. please take a look and help me.
[email protected]:~# #! /bin/bash
[email protected]:~# VBR=”2500k”
[email protected]:~# FPS=”30″
[email protected]:~# QUAL=”veryfast”
[email protected]:~# YOUTUBE_URL=”rtmp://a.rtmp.youtube.com/live2″
[email protected]:~# KEY=”sukh-q2uz-ckpg-w8f3-5vtf”
[email protected]:~# VIDEO_SOURCE=”home/ubuntu/video/babyrelax1.mp4″
[email protected]:~# AUDIO_ENCODER=”aac”
[email protected]:~# ffmpeg \
> -stream_loop -1 \
> -re \
> -i “$VIDEO_SOURCE” \
> -thread_queue_size 512 \
> -stream_loop -1 \
> -re \
> -f concat -i /home/ubuntu/music/audiofiles.txt \
> -map 0:v:0 -map 1:a:0 \
> -map_metadata:g 1:g \
> -c:v libx264 -preset $QUAL -r $FPS -g $(($FPS *2)) -b:v $VBR -bufsize 3000k -maxrate $VBR \
> -c:a $AUDIO_ENCODER -ar 44100 -b:a 128k -pix_fmt yuv420p \
> -f flv $YOUTUBE_URL/$YOUTUBE_KEY
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: –prefix=/usr –extra-version=1ubuntu0.1 –toolchain=hardened –libdir=/usr/lib/x86_64-linux-gnu –incdir=/usr/include/x86_64-linux-gnu –arch=amd64 –enable-gpl –disable-stripping –enable-avresample –disable-filter=resample –enable-avisynth –enable-gnutls –enable-ladspa –enable-libaom –enable-libass –enable-libbluray –enable-libbs2b –enable-libcaca –enable-libcdio –enable-libcodec2 –enable-libflite –enable-libfontconfig –enable-libfreetype –enable-libfribidi –enable-libgme –enable-libgsm –enable-libjack –enable-libmp3lame –enable-libmysofa –enable-libopenjpeg –enable-libopenmpt –enable-libopus –enable-libpulse –enable-librsvg –enable-librubberband –enable-libshine –enable-libsnappy –enable-libsoxr –enable-libspeex –enable-libssh –enable-libtheora –enable-libtwolame –enable-libvidstab –enable-libvorbis –enable-libvpx –enable-libwavpack –enable-libwebp –enable-libx265 –enable-libxml2 –enable-libxvid –enable-libzmq –enable-libzvbi –enable-lv2 –enable-omx –enable-openal –enable-opencl –enable-opengl –enable-sdl2 –enable-libdc1394 –enable-libdrm –enable-libiec61883 –enable-nvenc –enable-chromaprint –enable-frei0r –enable-libx264 –enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
“home/ubuntu/video/babyrelax1.mp4”: No such file or directory
Hello, thank you, i fixed it, it is error copy and paste on word.
Hello, thank you, i fixed it, it is error copy and paste on word.
See lessThat's great....
That’s great….
See less“home/ubuntu/video/babyrelax1.mp4”: No such file or directory This same error appears to me, but I could not solve it. Can you help me please?
“home/ubuntu/video/babyrelax1.mp4”: No such file or directory
This same error appears to me, but I could not solve it. Can you help me please?
See lessFriends, I managed to solve it in a much simpler way than I imagined. I'll leave here the code I used and the comments will follow below shortly after: #! /bin/bash VBR="1500k" FPS="24" QUAL="superfast" YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" YOUTUBE_KEY="spjs-50hd-ujx2-t2ma-1xe9" VIDEO_SOURCERead more
Friends, I managed to solve it in a much simpler way than I imagined. I’ll leave here the code I used and the comments will follow below shortly after:
#! /bin/bash
VBR=”1500k”
FPS=”24″
QUAL=”superfast”
YOUTUBE_URL=”rtmp://a.rtmp.youtube.com/live2″
YOUTUBE_KEY=”spjs-50hd-ujx2-t2ma-1xe9″
VIDEO_SOURCE=”/home/ubuntu/video/BG Fundo 01 720p.mp4″
AUDIO_ENCODER=”aac”
ffmpeg \
-stream_loop -1 \
-re \
-i “$VIDEO_SOURCE” \
-thread_queue_size 512 \
-stream_loop -1 \
-re \
-f concat -i /home/ubuntu/music/audiofiles.txt \
-map 0:v:0 -map 1:a:0 \
-map_metadata:g 1:g \
-c:v libx264 -preset $QUAL -r $FPS -g $(($FPS *2)) -b:v $VBR -bufsize 3000k -maxrate $VBR \
-c:a $AUDIO_ENCODER -ar 44100 -b:a 128k -pix_fmt yuv420p \
-f flv $YOUTUBE_URL/$YOUTUBE_KEY
By doing this I was able to concatenate the audio files without generating another output.mp3 file for streaming. The observations that I took as a rule and that make a total difference in this type of code are as follows:
I made the mapping of the video input and then audio, since in this case the video input was informed first.
This mapping only works if the lines “-map 0: v: 0 -map 1: a: 0 ” and “-map_metadata: g 1: g ” are just below the listed concatenated file which is audiofiles.txt and if they are before the call to the Audio and Video Codec that starts from the line “-c: v libx264 -preset (…)” onwards.
The concatenated files are in the same example directory as the “audiofiles.txt” file and their contents are as follows:
ffconcat version 1.0
file spontaneous01.mp3
file spontaneous02.mp3
file audiofiles.txt
Filenames with quotes or double quotes didn’t work at all, I don’t know the specific reason for that, but it really didn’t work.
See lessHello friends My live stream has been going for more than 12 hours but it has stopped and the following error message. My video is 1080p av_interleaved_write_frame(): Broken pipe Last message repeated 1 times [flv @ 0x56038d38da00] Failed to update header with correct duration. [flv @ 0x56038d38Read more
Hello friends
My live stream has been going for more than 12 hours but it has stopped and the following error message. My video is 1080p
av_interleaved_write_frame(): Broken pipe
Last message repeated 1 times
[flv @ 0x56038d38da00] Failed to update header with correct duration.
[flv @ 0x56038d38da00] Failed to update header with correct filesize.
Error writing trailer of rtmp://a.rtmp.youtube.com/live2/sukh-q2uz-ckpg-w8f3-5vtf: Broken pipe
my code:
#! /bin/bash
VBR=”2500k”
FPS=”30″
QUAL=”veryfast”
YOUTUBE_URL=”rtmp://a.rtmp.youtube.com/live2″
YOUTUBE_KEY=”sukh-q2uz-ckpg-w8f3-5vtf”
VIDEO_SOURCE=”/home/ubuntu/video/babyrelax1.mp4″
AUDIO_ENCODER=”aac”
ffmpeg \
-stream_loop -1 \
-re \
-i “$VIDEO_SOURCE” \
-thread_queue_size 512 \
-stream_loop -1 \
-re \
-f concat -i /home/ubuntu/music/audiofiles.txt \
-map 0:v:0 -map 1:a:0 \
-map_metadata:g 1:g \
-c:v libx264 -preset $QUAL -r $FPS -g $(($FPS *2)) -b:v $VBR -bufsize 3000k -maxrate $VBR -vf scale=1920:1080 \
-c:a $AUDIO_ENCODER -ar 44100 -b:a 128k -pix_fmt yuv420p \
-f flv $YOUTUBE_URL/$YOUTUBE_KEY
Thank you
Please take a look, help me , thank you
Please take a look, help me , thank you
See lessMy audio file: /home/ubuntu/music/audiofiles.txt ffconcat version 1.0 file pianolullaby.wav file audiofiles.txt
My audio file: /home/ubuntu/music/audiofiles.txt
ffconcat version 1.0
See lessfile pianolullaby.wav
file audiofiles.txt
How to read files from directory instead of txt file?
How to read files from directory instead of txt file?
See lessUnfortunately, as the function works with concat, it is only possible to read the audio files through a file that works as an indexer for all this, which in this case is the .txt file I mentioned above.
Unfortunately, as the function works with concat, it is only possible to read the audio files through a file that works as an indexer for all this, which in this case is the .txt file I mentioned above.
See lesshow can I repeat files for Live? So it can live up to 1 full day with limited video duration
how can I repeat files for Live? So it can live up to 1 full day with limited video duration
See less