[FFmpeg-user] av_interleaved_write_frame(): Broken pipe with drawtext

Paul Pasquale paul at 7riversys.com
Tue Mar 8 02:09:01 CET 2016


Hi,

I'm having trouble getting ffserver & ffmpeg working with drawtext. I
receive the error "av_interleaved_write_frame(): Broken pipe" and then
ffmpeg stops.

ffserver configuration:

> HTTPPort 80
>
> HTTPBindAddress 0.0.0.0
>
> MaxClients 10
>
> MaxBandwidth 500
>
>
> <Feed webcam.ffm>
>
> File /tmp/ffstuff/feed0.ffm
>
> FileMaxSize 10M
>
> </Feed>
>
>
> <Stream webcam.flv>
>
> #File /tmp/ffstuff/feed0.ffm
>
> Feed webcam.ffm
>
> Format flv
>
> VideoSize 320x240
>
> VideoFrameRate 30
>
> VideoBitRate 200
>
> VideoBufferSize 20
>
> #NoAudio
>
> AudioChannels 1
>
> AudioSampleRate 11025
>
> VideoQMin 1
>
> VideoQMax 10
>
> #NoDefaults
>
> </Stream>
>
>
> <Stream stat.html>
>
> Format status
>
> </Stream>
>

ffmpeg command:

ffmpeg -v debug -f alsa -ac 2 -i hw:1 -f video4linux2  -i /dev/video0 -r 30
-s 320x240 -filter_complex
"drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf:
text='text'" http://localhost/webcam.ffm

ffmpeg output:

> ffmpeg version N-78843-g1c7e2cf Copyright (c) 2000-2016 the FFmpeg
> developers
>
>   built with gcc 4.9.2 (Raspbian 4.9.2-10)
>
>   configuration: --enable-libfreetype --enable-libfontconfig
> --enable-libfribidi
>
>   libavutil      55. 19.100 / 55. 19.100
>
>   libavcodec     57. 27.101 / 57. 27.101
>
>   libavformat    57. 27.100 / 57. 27.100
>
>   libavdevice    57.  0.101 / 57.  0.101
>
>   libavfilter     6. 37.100 /  6. 37.100
>
>   libswscale      4.  0.100 /  4.  0.100
>
>   libswresample   2.  0.101 /  2.  0.101
>
> Splitting the commandline.
>
> Reading option '-v' ... matched as option 'v' (set logging level) with
> argument 'debug'.
>
> Reading option '-f' ... matched as option 'f' (force format) with argument
> 'alsa'.
>
> Reading option '-ac' ... matched as option 'ac' (set number of audio
> channels) with argument '2'.
>
> Reading option '-i' ... matched as input file with argument 'hw:1'.
>
> Reading option '-f' ... matched as option 'f' (force format) with argument
> 'video4linux2'.
>
> Reading option '-i' ... matched as input file with argument '/dev/video0'.
>
> Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
> fraction or abbreviation)) with argument '30'.
>
> Reading option '-s' ... matched as option 's' (set frame size (WxH or
> abbreviation)) with argument '320x240'.
>
> Reading option '-filter_complex' ... matched as option 'filter_complex'
> (create a complex filtergraph) with argument
> 'drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf:
> text='babypi''.
>
> Reading option 'http://localhost/webcam.ffm' ... matched as output file.
>
> Finished splitting the commandline.
>
> Parsing a group of options: global .
>
> Applying option v (set logging level) with argument debug.
>
> Applying option filter_complex (create a complex filtergraph) with
> argument
> drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf:
> text='babypi'.
>
> Successfully parsed a group of options.
>
> Parsing a group of options: input file hw:1.
>
> Applying option f (force format) with argument alsa.
>
> Applying option ac (set number of audio channels) with argument 2.
>
> Successfully parsed a group of options.
>
> Opening an input file: hw:1.
>
> [alsa @ 0x2cf73a0] All info found
>
> Guessed Channel Layout for  Input Stream #0.0 : stereo
>
> Input #0, alsa, from 'hw:1':
>
>   Duration: N/A, start: 1457398685.941241, bitrate: 1024 kb/s
>
>     Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 32000 Hz, 2 channels,
> s16, 1024 kb/s
>
> Successfully opened the file.
>
> Parsing a group of options: input file /dev/video0.
>
> Applying option f (force format) with argument video4linux2.
>
> Successfully parsed a group of options.
>
> Opening an input file: /dev/video0.
>
> [video4linux2,v4l2 @ 0x2d01eb0] fd:3 capabilities:84200001
>
> [video4linux2,v4l2 @ 0x2d01eb0] Current input_channel: 0, input_name:
> Camera 1, input_std: 0
>
> [video4linux2,v4l2 @ 0x2d01eb0] Querying the device for the current frame
> size
>
> [video4linux2,v4l2 @ 0x2d01eb0] Setting frame size to 320x240
>
> [video4linux2,v4l2 @ 0x2d01eb0] The V4L2 driver changed the pixel format
> from 0x32315559 to 0x56595559
>
> [video4linux2,v4l2 @ 0x2d01eb0] Trying to set codec:rawvideo
> pix_fmt:yuv420p
>
> [video4linux2,v4l2 @ 0x2d01eb0] The V4L2 driver changed the pixel format
> from 0x32315559 to 0x56595559
>
> [video4linux2,v4l2 @ 0x2d01eb0] Trying to set codec:rawvideo
> pix_fmt:yuv420p
>
> [video4linux2,v4l2 @ 0x2d01eb0] The V4L2 driver changed the pixel format
> from 0x32315659 to 0x56595559
>
> [video4linux2,v4l2 @ 0x2d01eb0] Trying to set codec:rawvideo
> pix_fmt:yuv422p
>
> [video4linux2,v4l2 @ 0x2d01eb0] The V4L2 driver changed the pixel format
> from 0x50323234 to 0x56595559
>
> [video4linux2,v4l2 @ 0x2d01eb0] Trying to set codec:rawvideo
> pix_fmt:yuyv422
>
> [video4linux2,v4l2 @ 0x2d01eb0] All info found
>
> Input #1, video4linux2,v4l2, from '/dev/video0':
>
>   Duration: N/A, start: 79423.600411, bitrate: 36864 kb/s
>
>     Stream #1:0, 1, 1/1000000: Video: rawvideo, 1 reference frame (YUY2 /
> 0x32595559), yuyv422, 320x240, 1/1000000, 36864 kb/s, 30 fps, 30 tbr, 1000k
> tbn, 1000k tbc
>
> Successfully opened the file.
>
> detected 4 logical cores
>
> [Parsed_drawtext_0 @ 0x2d039c0] Setting 'fontfile' to value
> '/usr/share/fonts/truetype/freefont/FreeSerif.ttf'
>
> [Parsed_drawtext_0 @ 0x2d039c0] Setting 'text' to value 'babypi'
>
> Parsing a group of options: output file http://localhost/webcam.ffm.
>
> Applying option r (set frame rate (Hz value, fraction or abbreviation))
> with argument 30.
>
> Applying option s (set frame size (WxH or abbreviation)) with argument
> 320x240.
>
> Successfully parsed a group of options.
>
> Opening an output file: http://localhost/webcam.ffm.
>
> [http @ 0x2d07f30] Setting default whitelist
> 'http,https,tls,rtp,tcp,udp,crypto'
>
> [tcp @ 0x2d03640] Connection to tcp://localhost:80 failed (Connection
> refused), trying next address
>
> [http @ 0x2d07f30] request: GET /webcam.ffm HTTP/1.1
>
> User-Agent: Lavf/57.27.100
>
> Accept: */*
>
> Range: bytes=0-
>
> Connection: close
>
> Host: localhost
>
> Icy-MetaData: 1
>
>
>
> [ffm @ 0x2d079d0] Format ffm probed with size=2048 and score=101
>
> [NULL @ 0x2d0b1f0] Setting entry with key 'ac' to value '1'
>
> [NULL @ 0x2d0b1f0] Setting entry with key 'ar' to value '11025'
>
> [NULL @ 0x2d0b1f0] Setting entry with key 'b' to value '64000'
>
> [NULL @ 0x2d0b9e0] Setting entry with key 'video_size' to value '320x240'
>
> [NULL @ 0x2d0b9e0] Setting entry with key 'time_base' to value '1/30'
>
> [NULL @ 0x2d0b9e0] Setting entry with key 'b' to value '200000'
>
> [NULL @ 0x2d0b9e0] Setting entry with key 'bufsize' to value '163840'
>
> [NULL @ 0x2d0b9e0] Setting entry with key 'qmin' to value '1'
>
> [NULL @ 0x2d0b9e0] Setting entry with key 'qmax' to value '10'
>
> [NULL @ 0x2d0b9e0] Setting entry with key 'bt' to value '50000'
>
> [NULL @ 0x2d0b9e0] Setting entry with key 'maxrate' to value '400000'
>
> [AVIOContext @ 0x2d11e40] Statistics: 4096 bytes read, 0 seeks
>
> [http @ 0x2d07a80] Setting default whitelist
> 'http,https,tls,rtp,tcp,udp,crypto'
>
> [tcp @ 0x2d0d160] Connection to tcp://localhost:80 failed (Connection
> refused), trying next address
>
> [http @ 0x2d07a80] request: POST /webcam.ffm HTTP/1.1
>
> Transfer-Encoding: chunked
>
> User-Agent: Lavf/57.27.100
>
> Accept: */*
>
> Connection: close
>
> Host: localhost
>
> Icy-MetaData: 1
>
>
>
> Successfully opened the file.
>
> [Parsed_drawtext_0 @ 0x2d09410] Setting 'fontfile' to value
> '/usr/share/fonts/truetype/freefont/FreeSerif.ttf'
>
> [Parsed_drawtext_0 @ 0x2d09410] Setting 'text' to value 'babypi'
>
> [graph 0 input from stream 1:0 @ 0x2d1b490] Setting 'video_size' to value
> '320x240'
>
> [graph 0 input from stream 1:0 @ 0x2d1b490] Setting 'pix_fmt' to value '1'
>
> [graph 0 input from stream 1:0 @ 0x2d1b490] Setting 'time_base' to value
> '1/1000000'
>
> [graph 0 input from stream 1:0 @ 0x2d1b490] Setting 'pixel_aspect' to
> value '0/1'
>
> [graph 0 input from stream 1:0 @ 0x2d1b490] Setting 'sws_param' to value
> 'flags=2'
>
> [graph 0 input from stream 1:0 @ 0x2d1b490] Setting 'frame_rate' to value
> '30/1'
>
> [graph 0 input from stream 1:0 @ 0x2d1b490] w:320 h:240 pixfmt:yuyv422
> tb:1/1000000 fr:30/1 sar:0/1 sws_param:flags=2
>
> [scaler for output stream 0:0 @ 0x2d1b730] Setting 'w' to value '320'
>
> [scaler for output stream 0:0 @ 0x2d1b730] Setting 'h' to value '240'
>
> [scaler for output stream 0:0 @ 0x2d1b730] Setting 'flags' to value
> 'bicubic'
>
> [scaler for output stream 0:0 @ 0x2d1b730] w:320 h:240 flags:'bicubic'
> interl:0
>
> [format @ 0x2d1bbc0] compat: called with args=[yuv420p]
>
> [format @ 0x2d1bbc0] Setting 'pix_fmts' to value 'yuv420p'
>
> [auto-inserted scaler 0 @ 0x2d1cab0] w:iw h:ih flags:'bilinear' interl:0
>
> [Parsed_drawtext_0 @ 0x2d09410] auto-inserting filter 'auto-inserted
> scaler 0' between the filter 'graph 0 input from stream 1:0' and the filter
> 'Parsed_drawtext_0'
>
> [AVFilterGraph @ 0x2d0d2f0] query_formats: 5 queried, 3 merged, 1 already
> done, 0 delayed
>
> [auto-inserted scaler 0 @ 0x2d1cab0] picking yuv422p out of 60
> ref:yuyv422 alpha:0
>
> [auto-inserted scaler 0 @ 0x2d1cab0] w:320 h:240 fmt:yuyv422 sar:0/1 ->
> w:320 h:240 fmt:yuv422p sar:0/1 flags:0x2
>
> [scaler for output stream 0:0 @ 0x2d1b730] w:320 h:240 fmt:yuv422p
> sar:0/1 -> w:320 h:240 fmt:yuv420p sar:0/1 flags:0x4
>
> [graph 1 input from stream 0:0 @ 0x2cf7180] Setting 'time_base' to value
> '1/32000'
>
> [graph 1 input from stream 0:0 @ 0x2cf7180] Setting 'sample_rate' to
> value '32000'
>
> [graph 1 input from stream 0:0 @ 0x2cf7180] Setting 'sample_fmt' to value
> 's16'
>
> [graph 1 input from stream 0:0 @ 0x2cf7180] Setting 'channel_layout' to
> value '0x3'
>
> [graph 1 input from stream 0:0 @ 0x2cf7180] tb:1/32000 samplefmt:s16
> samplerate:32000 chlayout:0x3
>
> [audio format for output stream 0:1 @ 0x2d42a30] Setting 'sample_fmts' to
> value 's16'
>
> [audio format for output stream 0:1 @ 0x2d42a30] Setting 'sample_rates'
> to value '11025'
>
> [audio format for output stream 0:1 @ 0x2d42a30] Setting
> 'channel_layouts' to value '0x4'
>
> [audio format for output stream 0:1 @ 0x2d42a30] auto-inserting filter
> 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the
> filter 'audio format for output stream 0:1'
>
> [AVFilterGraph @ 0x2d41fb0] query_formats: 4 queried, 6 merged, 3 already
> done, 0 delayed
>
> [auto-inserted resampler 0 @ 0x2d43d80] [SWR @ 0x2d43f90] Using s16p
> internally between filters
>
> [auto-inserted resampler 0 @ 0x2d43d80] [SWR @ 0x2d43f90] Matrix
> coefficients:
>
> [auto-inserted resampler 0 @ 0x2d43d80] [SWR @ 0x2d43f90] FC: FL:0.500000
> FR:0.500000
>
> [auto-inserted resampler 0 @ 0x2d43d80] ch:2 chl:stereo fmt:s16 r:32000Hz
> -> ch:1 chl:mono fmt:s16 r:11025Hz
>
> [graph 2 input from stream 1:0 @ 0x2d42e20] Setting 'video_size' to value
> '320x240'
>
> [graph 2 input from stream 1:0 @ 0x2d42e20] Setting 'pix_fmt' to value '1'
>
> [graph 2 input from stream 1:0 @ 0x2d42e20] Setting 'time_base' to value
> '1/1000000'
>
> [graph 2 input from stream 1:0 @ 0x2d42e20] Setting 'pixel_aspect' to
> value '0/1'
>
> [graph 2 input from stream 1:0 @ 0x2d42e20] Setting 'sws_param' to value
> 'flags=2'
>
> [graph 2 input from stream 1:0 @ 0x2d42e20] Setting 'frame_rate' to value
> '30/1'
>
> [graph 2 input from stream 1:0 @ 0x2d42e20] w:320 h:240 pixfmt:yuyv422
> tb:1/1000000 fr:30/1 sar:0/1 sws_param:flags=2
>
> [scaler for output stream 0:2 @ 0x2d43920] Setting 'w' to value '320'
>
> [scaler for output stream 0:2 @ 0x2d43920] Setting 'h' to value '240'
>
> [scaler for output stream 0:2 @ 0x2d43920] Setting 'flags' to value
> 'bicubic'
>
> [scaler for output stream 0:2 @ 0x2d43920] w:320 h:240 flags:'bicubic'
> interl:0
>
> [format @ 0x2d50610] compat: called with args=[yuv420p]
>
> [format @ 0x2d50610] Setting 'pix_fmts' to value 'yuv420p'
>
> [AVFilterGraph @ 0x2d42db0] query_formats: 5 queried, 4 merged, 0 already
> done, 0 delayed
>
> [scaler for output stream 0:2 @ 0x2d43920] w:320 h:240 fmt:yuyv422
> sar:0/1 -> w:320 h:240 fmt:yuv420p sar:0/1 flags:0x4
>
> [mpeg1video @ 0x2d05810] intra_quant_bias = 96 inter_quant_bias = 0
>
> [flv @ 0x2d0dbf0] intra_quant_bias = 0 inter_quant_bias = -64
>
> Output #0, ffm, to 'http://localhost/webcam.ffm':
>
>   Metadata:
>
>     creation_time   : 2016-03-08 00:58:06
>
>     encoder         : Lavf57.27.100
>
>     Stream #0:0, 0, 1/1000000: Video: mpeg1video, 1 reference frame,
> yuv420p, 320x240, 1/30, q=2-31, 200 kb/s, 30 fps, 1000k tbn, 30 tbc
>
>     Metadata:
>
>       encoder         : Lavc57.27.101 mpeg1video
>
>     Side data:
>
>       cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
>
>     Stream #0:1, 0, 1/1000000: Audio: adpcm_swf, 11025 Hz, mono, s16, 44
> kb/s
>
>     Metadata:
>
>       encoder         : Lavc57.27.101 adpcm_swf
>
>     Stream #0:2, 0, 1/1000000: Video: flv1 (flv), 1 reference frame,
> yuv420p, 320x240, 1/30, q=1-10, 200 kb/s, 30 fps, 1000k tbn, 30 tbc
>
>     Metadata:
>
>       encoder         : Lavc57.27.101 flv
>
>     Side data:
>
>       cpb: bitrate max/min/avg: 400000/0/200000 buffer size: 163840
> vbv_delay: -1
>
> Stream mapping:
>
>   Stream #1:0 (rawvideo) -> drawtext (graph 0)
>
>   drawtext (graph 0) -> Stream #0:0 (mpeg1video)
>
>   Stream #0:0 -> #0:1 (pcm_s16le (native) -> adpcm_swf (native))
>
>   Stream #1:0 -> #0:2 (rawvideo (native) -> flv1 (flv))
>
> Press [q] to stop, [?] for help
>
> cur_dts is invalid (this is harmless if it occurs once at the start per
> stream)
>
>     Last message repeated 2 times
>
> [rawvideo @ 0x2d03080] PACKET SIZE: 153600, STRIDE: 640
>
> [Parsed_drawtext_0 @ 0x2d09410] n:0 t:0.000000 text_w:43 text_h:16 x:0 y:0
>
> Clipping frame in rate conversion by 0.000008
>
>     Last message repeated 1 times
>
> cur_dts is invalid (this is harmless if it occurs once at the start per
> stream)
>
>     Last message repeated 1 times
>
> [rawvideo @ 0x2d03080] PACKET SIZE: 153600, STRIDE: 640
>
> [Parsed_drawtext_0 @ 0x2d09410] n:1 t:0.028944 text_w:43 text_h:16 x:0 y:0
>
> Clipping frame in rate conversion by 0.131676
>
>     Last message repeated 1 times
>
> cur_dts is invalid (this is harmless if it occurs once at the start per
> stream)
>
> [alsa @ 0x2cf73a0] Thread message queue blocking; consider raising the
> thread_queue_size option (current value: 8)
>
> cur_dts is invalid (this is harmless if it occurs once at the start per
> stream)
>
>     Last message repeated 23 times
>
> av_interleaved_write_frame(): Broken pipe
>
> No more output streams to write to, finishing.
>
> av_interleaved_write_frame(): Broken pipe
>
> Error writing trailer of http://localhost/webcam.ffm: Broken pipeframe=
>   2 fps=0.0 q=2.0 Lq=10.2 size=      32kB time=00:00:00.06
> bitrate=3932.1kbits/s speed=0.536x
>
> video:25kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 27.417662%
>
> Input file #0 (hw:1):
>
>   Input stream #0:0 (audio): 25 packets read (6272 bytes); 25 frames
> decoded (1568 samples);
>
>   Total: 25 packets (6272 bytes) demuxed
>
> Input file #1 (/dev/video0):
>
>   Input stream #1:0 (video): 2 packets read (307200 bytes); 2 frames
> decoded;
>
>   Total: 2 packets (307200 bytes) demuxed
>
> Output file #0 (http://localhost/webcam.ffm):
>
>   Output stream #0:0 (video): 2 frames encoded; 2 packets muxed (16343
> bytes);
>
>   Output stream #0:1 (audio): 1 frames encoded (512 samples); 1 packets
> muxed (259 bytes);
>
>   Output stream #0:2 (video): 2 frames encoded; 2 packets muxed (9115
> bytes);
>
>   Total: 5 packets (25717 bytes) muxed
>
> 27 frames successfully decoded, 0 decoding errors
>
> [AVIOContext @ 0x2d09960] Statistics: 0 seeks, 8 writeouts
>
> Conversion failed!
>

Any help or insight would be appreciated. Thanks!

Paul
paul at 7riversys.com


More information about the ffmpeg-user mailing list