Home/
wesleyhenriques/Answers
- About
- Questions
- Polls
- Answers
- Best Answers
- Asked
- Followed
- Favorites
- Groups
- Posts
- Comments
- Followers Questions
- Followers Answers
- Followers Posts
- Followers Comments
- Questions
- Polls
- Answers
- Best Answers
- Asked
- Followed
- Favorites
- Groups
- Posts
- Comments
- Followers Questions
- Followers Answers
- Followers Posts
- Followers Comments
How can I stream multiple audio files and a static JPEG image via the terminal?
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.
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 stream multiple audio files and a static JPEG image via the terminal?
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_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 lessHow can I stream multiple audio files and a static JPEG image via the terminal?
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!
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 less