Output video segments over a channel using FFmpeg

My Node.js application uses FFmpeg to capture video on a DirectShow device, and then to output segments for real-time streaming (HLS). At the moment, I am outputting segments to files, however, if I could output them through a pipe, this would allow me to efficiently send a segment via websocket instead of hosting an HTTP server.

I tried using this command:

ffmpeg -y -f dshow -i video = FFsource: audio = Stereo Mix (Realtek High Definition Audio) -vcodec libvpx -acodec libvorbis -threads 0 -b: v 3300k -cpu-used 5 -keyint_min 150 -g 150-map 0 flag: v + global_header -f segment -

However, it gives the error "Failed to write a header for output file No. 0 (incorrect codec parameters?): Muxer not found." These commands work for output to files (by replacing '-' with 'seg_% 03d.webm').

Does FFmpeg support channels for segmented video, or is there something wrong with the command? Thank.

+4
source share
1 answer

You can pass ffmpeg -i pipe:0 pipe:1for reading from stdin and output to stdout.

You can see an example of the FFmpeg shell that I use in one of my projects:

https://github.com/lperrin/node_airtunes/blob/master/examples/play_ffmpeg.js

, - . .

0

Source: https://habr.com/ru/post/1540399/


All Articles