[FFmpeg-user] Add soft subtitles to YouTube Stream Now?

Steven Kan steven at kan.org
Wed Nov 20 06:45:44 EET 2019


First time poster, so please be kind if I ask anything stupid!

I have a live BeeCam feed on YouTube:

https://www.youtube.com/channel/UCE0jx2Z6qbc5Co8x8Kyisag/live <https://www.youtube.com/channel/UCE0jx2Z6qbc5Co8x8Kyisag/live>

using YouTube’s “Stream Now” feature, which is distinct from a streaming “event” because I don’t have to schedule it. Whenever I’m pushing video to YouTube, the channel goes live.

The stream is supplied by a Raspberry Pi running as an ffmpeg “relay server,” e.g. it’s not doing any transcoding; it’s just repacking an RTSP stream from an off-the-shelf camera:

./ffmpeg -re -thread_queue_size 512 -rtsp_transport tcp -i "rtsp://anonymous:password@192.168.1.11:554" -f concat -safe 0 -i playlist.txt -vcodec copy -acodec copy -t 01:47:02 -f flv "rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key”

The -t and playlist.txt are because my camera lacks and audio feed, and YT requires an audio stream, so I have a collection of royalty-free mp3s in the playlist, and I’m wrapping this command in a loop.

When I run this on my RPi 2, CPU utilization for ffmpeg is <<<<10%, which is what I want, because I will have up to 3 instances of ffmpeg pushing 3 camera streams to 3 YT channels during honey bee swarm season in Spring.

What I want to do is add some captions to the video as soft subtitles, e.g. my location, the present temperature, and the weather forecast. I don’t have enough CPU on the Pi to burn these into the video stream.

Is this possible in ffmpeg and with YouTube’s “stream now” feature?

I can get ffmpeg to put a soft subtitle into a local .mkv file:

./ffmpeg -i video.mp4" -i SubtitleTest.srt -acodec copy -scodec copy out.mkv

but I changing the output to .m4v, mp4, or .flv results in errors such as:

Subtitle codec 'ass' for stream 2 is not compatible with FLV

and pushing mkv to YouTube via:

./ffmpeg -i video.mp4" -acodec copy -f mkv "rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key”

returns:

Requested output format 'mkv' is not a suitable output format
rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key <rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key>

Am I doing this fundamentally wrong? Or is this just not possible? If it’s possible I will continue reading documentation until I get it working!!!

Thanks!



More information about the ffmpeg-user mailing list