My Node.js app uses FFmpeg to capture video of a DirectShow device and then output segments for live streaming (HLS). At the moment I'm outputting the segments to files, however if I could output them via a pipe it would allow me to efficiently send the segment via a websocket instead of hosting a HTTP server.
I've tried using this mand:
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 -flags:v +global_header -f segment -
However it gives the error "Could not write header for output file #0 (incorrect codec parameters ?): Muxer not found". This mands works for outputting to files (by replacing '-' with 'seg_%03d.webm').
Does FFmpeg not support pipes for segmented video, or is there something wrong with the mand? Thanks.
My Node.js app uses FFmpeg to capture video of a DirectShow device and then output segments for live streaming (HLS). At the moment I'm outputting the segments to files, however if I could output them via a pipe it would allow me to efficiently send the segment via a websocket instead of hosting a HTTP server.
I've tried using this mand:
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 -flags:v +global_header -f segment -
However it gives the error "Could not write header for output file #0 (incorrect codec parameters ?): Muxer not found". This mands works for outputting to files (by replacing '-' with 'seg_%03d.webm').
Does FFmpeg not support pipes for segmented video, or is there something wrong with the mand? Thanks.
Share Improve this question asked May 13, 2014 at 16:24 Joey MoraniJoey Morani 26.6k33 gold badges89 silver badges132 bronze badges 2- What does it mean to output segmented files on a pipe? – vipw Commented May 14, 2014 at 17:29
- did you find a solution? – ESala Commented Dec 10, 2017 at 11:23
2 Answers
Reset to default 3Use -f nut
instead of -f segment
. The nut
format could contain all types of headers and audio, video codecs.
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 -flags:v +global_header -f nut pipe:
You can pass ffmpeg -i pipe:0 pipe:1
to read from stdin and output to stdout.
You can take a look at an example FFmpeg wrapper I use in one of my projects:
https://github./lperrin/node_airtunes/blob/master/examples/play_ffmpeg.js
If you plan on streaming from the network, you might need a circular buffer at some point. There's one in the project you can snatch.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744239134a4564616.html
评论列表(0条)