libcaption
libcaption copied to clipboard
Does this work for an rtmp stream in and out?
Working on adding live subtitles to a live stream. I have this working on another platform using HLS, with subtitles.
Using the example flv+srt binary, I am having no luck creating an output:
Example stanza:
ffmpeg -i rtmp://localhost/show/stream -codec copy -f flv - | flv+srt - /tmp/eng-fifo - | ffmpeg -i - -codec copy rtmp://localhost/subs/stream
I see output that looks like the subtitles are being read:
Loaded new SRT at time 0.000000
T: 0.00 (6.76s):
based on the fact that Aurora might be oversold here and
T: 6.78 (5.23s): 38 q=-1.0 size= 2218kB time=00:00:06.45 bitrate=2815.4kbits/s
bouncing maybe some good news for the sector I don't know what who am
T: 12.01 (2.97s):34 q=-1.0 size= 3773kB time=00:00:11.54 bitrate=2678.0kbits/s
I kidding, it's amazing
However I don't see any output stream, and all I eventually see after quitting ffmpeg is:
[flv @ 0x1f29400] Could not find codec parameters for stream 0 (Video: flv1 (flv), yuv420p): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[flv @ 0x1f29400] Could not find codec parameters for stream 1 (Audio: none, 0 channels): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
pipe:: could not find codec parameters
Input #0, flv, from 'pipe:':
Duration: N/A, start: 2728370.006000, bitrate: N/A
Stream #0:0: Video: flv1, yuv420p, 1k tbr, 1k tbn, 1k tbc
Stream #0:1: Audio: none, 0 channels
[NULL @ 0x1f3d360] Unable to find a suitable output format for 'rtmp://localhost/subs/stream'
rtmp://localhost/subs/stream: Invalid argument
I'm still playing around with parameters, but I am unsure if this is a suitable approach to begin with.
Were you able to make any progress on this? We're also trying to accomplish this in #55.
was anyone able to progress with this?
I see that this same issue has popped up in a few places. I'm working on this as well, my approach is slightly different though. I'm using named pipes to pipe data from ffmpeg to flv+srt to ffmpeg. Using the standard pipe, as the example above, did not work for me either.
ffmpeg -re -i INPUT_RTMP -c copy -f flv pipe:1 > /tmp/caption_in_pipe
flv+srt /tmp/caption_in_pipe /tmp/srt_pipe /tmp/caption_out_pipe
ffmpeg -re -i /tmp/caption_out_pipe -c copy -f flv -y OUTPUT_RTMP
This all works so far, except nothing is being read from the /tmp/srt_pipe. If i use an SRT file instead, it works and the captions are added to the outgoing stream.
Has anyone had any luck reading SRT from a named pipe?