admin管理员组文章数量:1400384
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.
本文标签: javascriptOutput video segments via a pipe using FFmpegStack Overflow
版权声明:本文标题:javascript - Output video segments via a pipe using FFmpeg - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744239134a2596700.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论