ffmpeg to stream webcam to http:// and file?
How do I use ffmpeg to stream webcam to http:// and file? - Attempting to record the video and audio of one stream (a local webcam) to both a filename and a server. Current approach: ffmpeg -f avfoundation -framerate 30 -i "FaceTime HD Camera":"Built-in Microphone" http://0.0.0.0:8090/stream0.webm "stream0.$(date +%s).webm" Basic HTML: <!DOCTYPE html> <html> <head></head> <body> <h2>stream0</h2> <video src="http://0.0.0.0:8090/stream0.webm" autoplay></video> </body> </html> But unfortunately I get this error: av_interleaved_write_frame(): Broken pipe frame= 49 fps=1.4 q=0.0 size= 1kB time=00:00:00.89 bitrate= 6.5kbits/sav_interleaved_write_frame(): Broken pipe Error writing trailer of http://0.0.0.0:8090/stream0.webm: Broken pipe The server on port 8090 is ffserver <https://trac.ffmpeg.org/wiki/ffserver> with default conf <http://ffmpeg.org/sample.html>. Thanks for all suggestions
On Wed, Dec 06, 2017 at 06:10:17 +1100, Alec Taylor wrote:
But unfortunately I get this error:
av_interleaved_write_frame(): Broken pipe frame= 49 fps=1.4 q=0.0 size= 1kB time=00:00:00.89 bitrate= 6.5kbits/sav_interleaved_write_frame(): Broken pipe Error writing trailer of http://0.0.0.0:8090/stream0.webm: Broken pipe
The server on port 8090 is ffserver <https://trac.ffmpeg.org/wiki/ffserver> with default conf <http://ffmpeg.org/sample.html>.
What does ffserver say in its log output? Also, what does your ffserver.conf look like (exactly)? Feel free to attach. (I think you're confusing ffmpeg feed vs. client URI.) While you are at it, also please show the complete, uncut console output of ffmpeg. Thanks, Moritz
Posting full output below. Thanks. As for the ffserver.conf; I am using an unaltered http://ffmpeg.org/sample.html $ ffmpeg -f avfoundation -framerate 30 -i "FaceTime HD Camera":"Built-in Microphone" http://0.0.0.0:8090/stream0.webm ffmpeg version N-89395-g71421f382f Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 9.0.0 (clang-900.0.38) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox libavutil 56. 5.100 / 56. 5.100 libavcodec 58. 6.102 / 58. 6.102 libavformat 58. 2.103 / 58. 2.103 libavdevice 58. 0.100 / 58. 0.100 libavfilter 7. 6.100 / 7. 6.100 libswscale 5. 0.101 / 5. 0.101 libswresample 3. 0.101 / 3. 0.101 libpostproc 55. 0.100 / 55. 0.100 [avfoundation @ 0x7fb8ca800000] Selected pixel format (yuv420p) is not supported by the input device. [avfoundation @ 0x7fb8ca800000] Supported pixel formats: [avfoundation @ 0x7fb8ca800000] uyvy422 [avfoundation @ 0x7fb8ca800000] yuyv422 [avfoundation @ 0x7fb8ca800000] nv12 [avfoundation @ 0x7fb8ca800000] 0rgb [avfoundation @ 0x7fb8ca800000] bgr0 [avfoundation @ 0x7fb8ca800000] Overriding selected pixel format to use uyvy422 instead. Input #0, avfoundation, from 'FaceTime HD Camera:Built-in Microphone': Duration: N/A, start: 12125.179728, bitrate: N/A Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1280x720, 30 tbr, 1000k tbn, 1000k tbc Stream #0:1: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> vp9 (libvpx-vp9)) Stream #0:1 -> #0:1 (pcm_f32le (native) -> opus (libopus)) Press [q] to stop, [?] for help [libopus @ 0x7fb8c90e5e00] No bit rate set. Defaulting to 96000 bps. [libvpx-vp9 @ 0x7fb8c90e4c00] v1.6.1 Output #0, webm, to 'http://0.0.0.0:8090/stream0.webm': Metadata: encoder : Lavf58.2.103 Stream #0:0: Video: vp9 (libvpx-vp9), yuv422p, 1280x720, q=-1--1, 200 kb/s, 30 fps, 1k tbn, 30 tbc Metadata: encoder : Lavc58.6.102 libvpx-vp9 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream #0:1: Audio: opus (libopus), 48000 Hz, stereo, flt, 96 kb/s Metadata: encoder : Lavc58.6.102 libopus av_interleaved_write_frame(): Broken pipe time=00:00:01.40 bitrate= 0.0kbits/s speed=2.74x Error writing trailer of http://0.0.0.0:8090/stream0.webm: Broken pipe frame= 25 fps=0.7 q=0.0 Lsize= 1kB time=00:00:01.74 bitrate= 3.3kbits/s speed=0.05x video:7kB audio:13kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Conversion failed! $ ffserver -f ~/repos/stereostream/stereostream-scripts/ffserver.conf ffserver version 3.4 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 9.0.0 (clang-900.0.37) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 ffserver.conf:4: Port option is deprecated. Use HTTPPort instead. ffserver.conf:8: BindAddress option is deprecated. Use HTTPBindAddress instead. ffserver.conf:29: NoDaemon option has no effect. You should remove it. ffserver.conf:167: Setting default value for video bit rate tolerance = 21333. Use NoDefaults to disable it. ffserver.conf:167: Setting default value for video rate control equation = tex^qComp. Use NoDefaults to disable it. ffserver.conf:167: Setting default value for video max rate = 128000. Use NoDefaults to disable it. ffserver.conf:222: Setting default value for audio sample rate = 22050. Use NoDefaults to disable it. ffserver.conf:222: Setting default value for audio channel count = 1. Use NoDefaults to disable it. ffserver.conf:222: Setting default value for video bit rate tolerance = 64000. Use NoDefaults to disable it. ffserver.conf:222: Setting default value for video rate control equation = tex^qComp. Use NoDefaults to disable it. ffserver.conf:222: Setting default value for video max rate = 512000. Use NoDefaults to disable it. Wed Dec 6 06:36:47 2017 Codecs do not match for stream 0 Wed Dec 6 06:36:47 2017 [ffm @ 0x7f998a000400]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Wed Dec 6 06:36:47 2017 [ffm @ 0x7f998a000400]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Wed Dec 6 06:36:47 2017 [ffm @ 0x7f998a000400]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Wed Dec 6 06:36:47 2017 [ffm @ 0x7f998a000400]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Wed Dec 6 06:36:47 2017 FFserver started. Wed Dec 6 06:36:57 2017 File '/stream0.webm' not found Wed Dec 6 06:36:57 2017 127.0.0.1 - - [POST] "/stream0.webm HTTP/1.1" 404 193 Wed Dec 6 06:37:17 2017 File '/stream0.webm' not found Wed Dec 6 06:37:17 2017 127.0.0.1 - - [GET] "/stream0.webm HTTP/1.1" 404 193 On Wed, Dec 6, 2017 at 6:27 AM, Moritz Barsnick <barsnick@gmx.net> wrote:
On Wed, Dec 06, 2017 at 06:10:17 +1100, Alec Taylor wrote:
But unfortunately I get this error:
av_interleaved_write_frame(): Broken pipe frame= 49 fps=1.4 q=0.0 size= 1kB time=00:00:00.89 bitrate= 6.5kbits/sav_interleaved_write_frame(): Broken pipe Error writing trailer of http://0.0.0.0:8090/stream0.webm: Broken pipe
The server on port 8090 is ffserver <https://trac.ffmpeg.org/wiki/ ffserver> with default conf <http://ffmpeg.org/sample.html>.
What does ffserver say in its log output? Also, what does your ffserver.conf look like (exactly)? Feel free to attach. (I think you're confusing ffmpeg feed vs. client URI.)
While you are at it, also please show the complete, uncut console output of ffmpeg.
Thanks, Moritz _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On Wed, Dec 06, 2017 at 06:40:12 +1100, Alec Taylor wrote:
As for the ffserver.conf; I am using an unaltered http://ffmpeg.org/sample.html
$ ffmpeg -f avfoundation -framerate 30 -i "FaceTime HD Camera":"Built-in Microphone" http://0.0.0.0:8090/stream0.webm
Oh, then you actually need to read the ffserver documentation and browse through the config file. As the sample config file tells you: # You must use 'ffmpeg' to send a live feed to ffserver. In this # example, you can type: # # ffmpeg http://localhost:8090/feed1.ffm Change your ffmpeg URL to .../feed1.ffm, with the path part reflecting this entry: <Feed feed1.ffm> Apart from that, the sample config file isn't configured for webm. Moritz
participants (2)
-
Alec Taylor -
Moritz Barsnick