In my previously opened topic:
How to make FFmpeg automatically inject mp3 audio tracks in the single cycled muted video
I've got detailed explanation from @llogan how to broadcast looped short muted video on youtube automatically injecting audio tracks in it without interrupting a translation.
I plan to enhance the flow and the next question I faced with is how to dynamically put an additional text to the broadcast.
Prerequisites:
- youtube broadcast is up and running by ffmpeg
- short 3 min video is paying in infinity loop
- audio tracks from playlist are automatically taken by "ffmpeg concat" and injected in the video one by one
this is a basic command to start translation:
ffmpeg -re -fflags +genpts -stream_loop -1 -i video.mp4 -re -f concat -i input.txt -map 0:v -map 1:a -c:v libx264 -tune stillimage -vf format=yuv420p -c:a copy -g 20 -b:v 2000k -maxrate 2000k -bufsize 8000k -f flv rtmp://a.rtmp.youtube.com/live2/my-key
Improvements I want to bring
- I plan to store some metadata in audio files (basically it's an artist name and a song name)
- At the moment a particular song starts playing artist/song name should be taken from metadata and displayed on the video as text during the whole song is playing.
- When the current song finishes and a new one starts playing the previous artist/song text should be replaced with the new one etc
My question is how to properly take metadata and add it to the existing broadcast config using ffmpeg?
reloadandtextfileoptions (see Can you insert text from a file in real time with ffmpeg streaming?). The problem is that the audio files listed ininput.txtare basically treated as a single input and lose their "individuality". So the question becomes a matter of timing: how will you know when to update the title? - lloganinput.txtcalled like file1.m4a, file2.m4a so we'd need to have separate text files corresponding to filenames like file1.txt, file2.txt containing text and take text out of them. Then probably each time new song starts we should determine its filename duration or keep a separate file(-s) containing info about all tracks duration. But it doesn't seem a simple solution - Grrzly