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

Steven Kan steven at kan.org
Wed Nov 20 22:29:41 EET 2019


Hi Michael,

Thanks! I actually have a cron job to stop, pause, and restart the streams every 12 hours, because otherwise the YT archived videos sometimes fail to upload.

Somewhere in my processing chain something usually craps out every few days, but even then I would sometimes have streams that would go on for 3-4 days, and those would stuck in “Processing. . . “ forever, and never be available to watch afterward. This is critical for me, because one of my primary motivations for having this/these streams is to capture when a swarm moves into my swarm trap. By observing scouting behavior in early Spring I can usually tell that I’m within 3-4 days of a swarm moving in, but there’s no predicting exactly when. So I need to ensure that all of my archives get saved successully, like this one:

https://www.youtube.com/watch?v=OtjpylAEP8I&feature=youtu.be&t=1800 <https://www.youtube.com/watch?v=OtjpylAEP8I&feature=youtu.be&t=1800>

(that was post-processed to make a 2-up, but each half was taken by a camera, pushed to YT by ffmpeg)

So I actually have a watchdog timer running for each of my streams, plus the cron job to interrupt everything, twice a day.

But thanks for the offer!

> On Nov 20, 2019, at 10:11 AM, Michael Shaffer <mikeshaffer at gmail.com> wrote:
> 
> I noticed your Youtube streams only last a day or so. I have a Python
> script I made that keeps the ffmpeg process sending to Youtube. I have 5 IP
> cameras going to youtube and they have been going about 9 months without
> the stream ending. Anyways, if you want I could show you how the script
> works. You would just have to change the stream keys and the bitrate that
> each camera uses, so it knows when to restart the stream.
> 
> Michael
> 
> On Wed, Nov 20, 2019 at 12:17 AM Steven Kan <steven at kan.org> wrote:
> 
>> 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 at 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!
>> 
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list