最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Output video segments via a pipe using FFmpeg - Stack Overflow

programmeradmin9浏览0评论

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
Add a ment  | 

2 Answers 2

Reset to default 3

Use -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.

发布评论

评论列表(0)

  1. 暂无评论