I can extract closed caption information from an mp4 file using ffmpeg v. 3.4.7 thus:
ffmpeg -f lavfi -i movie="sample.mp4[out+subcc]" -map 0:1 -c:s webvtt /tmp/output.vtt
The file was obtained by capturing a live HLS stream containing closed captions. I would like to extract the closed captions directly from the stream, instead after storing the video in a file. I've tried various things, including:
ffmpeg -f lavfi -i movie="http://example.com/stream.m3u8[out+subcc]" -map 0:0 -c:s webvtt /tmp/output.vtt
But the movie filter does not recognize the URL, even though the ffmpeg filter documentation says that the file name for the movie filter is "not necessarily a file; it can also be a device or a stream accessed through some protocol":
[Parsed_movie_0 @ 0x264ad80] Failed to avformat_open_input 'http'
[lavfi @ 0x2647e80] Error initializing filter 'movie' with args 'http://example.com/stream.m3u8'
movie=http://example.com/stream.m3u8[out+subcc]: No such file or directory
When I capture the video form the stream like this:
ffmpeg -i http://example.com/stream.m3u8 /tmp/output.mp4
ffmpeg reports that the stream does contain closed captions (which is where the captured video file sample.mp4 got them):
Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 480x270 [SAR 1:1 DAR 16:9], Closed Captions, 14.99 fps, 14.99 tbr, 90k tbn, 29.97 tbc
Is it possible to do this? Thanks for any pointers.
movie filter can accept URLs you just need to escape ":" According to https://ffmpeg.org/ffmpeg-filters.html#Notes-on-filtergraph-escaping
this command should work
ffmpeg -f lavfi -i movie="http\\\://example.com/stream.m3u8[out+subcc]" -map 0:0 -c:s webvtt /tmp/output.vtt