[FFmpeg-user] Segmentation fault with tee and fifo muxers

Maxim Kozlov rogat1y at gmail.com
Fri Nov 4 22:28:42 EET 2016


Hi all!

Got Segmentation fault using tee and 2xfifo muxers.
With tee + one fifo evrything works fine.

# uname -a
Linux 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64
x86_64 x86_64 GNU/Linux

/opt/ffmpeg-git-20161104-64bit-static# ./ffmpeg -re -v verbose -i
sample.mp4 -vf scale=width=-2:height=320,fps=fps=15 -threads 8 -vcodec
libx264 -force_key_frames "expr:gte(t,n_forced*4)" -profile:v baseline
-preset:v ultrafast -x264opts
no-scenecut:force-cfr=1:vbv_maxrate=256:vbv_bufsize=256 -flags:v +cgop
-acodec aac -ac 2 -ab 256k -ar 44100 -map 0 -f tee "\
[f=fifo:onfail=ignore:fifo_format=flv]rtmp://host1/live-restream/demo|[f=fifo:onfail=ignore:fifo_format=flv]rtmp://host1/live-restream/demo0"
ffmpeg version N-82225-gb4e9252-static http://johnvansickle.com/ffmpeg/
Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.1 (Debian 5.4.1-3) 20161019
  configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gray --enable-libass --enable-libebur128
--enable-libfreetype --enable-libfribidi --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex
--enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 35.100 / 55. 35.100
  libavcodec     57. 66.101 / 57. 66.101
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 66.100 /  6. 66.100
  libswscale      4.  3.100 /  4.  3.100
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[h264 @ 0x3b32aa0] Reinit context to 512x288, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf56.26.101
    comment         : Creative Commons Attribution 3.0 -
http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:10:34.63, start: 0.000000, bitrate: 743 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline), 1 reference frame
(avc1 / 0x31637661), yuv420p(left), 512x288 [SAR 1:1 DAR 16:9], 640 kb/s,
30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 96 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[Parsed_scale_0 @ 0x3c4e140] w:-2 h:320 flags:'bicubic' interl:0
[Parsed_fps_1 @ 0x3b803c0] fps=15/1
[graph 0 input from stream 0:0 @ 0x3c4d720] w:512 h:288 pixfmt:yuv420p
tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
[Parsed_scale_0 @ 0x3c4e140] w:512 h:288 fmt:yuv420p sar:1/1 -> w:568 h:320
fmt:yuv420p sar:640/639 flags:0x4
[graph 1 input from stream 0:1 @ 0x3c2e8e0] tb:1/48000 samplefmt:fltp
samplerate:48000 chlayout:0x3
[audio format for output stream 0:1 @ 0x3c2f440] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the
filter 'audio format for output stream 0:1'
[auto-inserted resampler 0 @ 0x3c31400] ch:2 chl:stereo fmt:fltp r:48000Hz
-> ch:2 chl:stereo fmt:fltp r:44100Hz
[libx264 @ 0x3c4c120] using SAR=640/639
[libx264 @ 0x3c4c120] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x3c4c120] profile Constrained Baseline, level 2.1
[tee @ 0x3b360e0] filename:'rtmp://host1/live-restream/demo' format:fifo
[tee @ 0x3b360e0]     stream:0 codec:h264 type:video bsfs: null
[tee @ 0x3b360e0]     stream:1 codec:aac type:audio bsfs: null
Parsing...
Parsed protocol: 0
Parsed host    : host1
Parsed app     : live-restream
[tee @ 0x3b360e0] filename:'rtmp://host1/live-restream/demo0' format:fifo
[tee @ 0x3b360e0]     stream:0 codec:h264 type:video bsfs: null
[tee @ 0x3b360e0]     stream:1 codec:aac type:audio bsfs: null
Parsing...
Output #0, tee, to
'[f=fifo:onfail=ignore:fifo_format=flv]rtmp://host1/live-restream/demo|[f=fifo:onfail=ignore:fifo_format=flv]rtmp://host1/live-restream/demo0':
  Metadata:
    major_brand     : isom
Parsed protocol: 0
Parsed host    : host1
Parsed app     : live-restream
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 -
http://bbb3d.renderfarming.net
    encoder         : Lavf57.57.100
    Stream #0:0(und): Video: h264 (libx264), 1 reference frame,
yuv420p(left), 568x320 [SAR 640:639 DAR 16:9], q=-1--1, 15 fps, 15 tbn, 15
tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.66.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 256000/0/0 buffer size: 256000 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, delay 1024,
256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.66.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x3c2fac0] Reinit context to 512x288, pix_fmt: yuv420p
RTMP_Connect1, ... connected, handshaking
Segmentation fault





Working line

/opt/ffmpeg-git-20161104-64bit-static# ./ffmpeg -re -v verbose -i
sample.mp4 -vf scale=width=-2:height=320,fps=fps=30 -vcodec libx264
-force_key_frames "expr:gte(t,n_forced*4)" -profile:v baseline -preset:v
ultrafast -x264opts no-scenecut:force-cfr=1:vbv_maxrate=256:vbv_bufsize=256
-flags:v +cgop -acodec aac -ac 2 -ab 256k -ar 44100 -map 0 -f tee "\
[f=fifo:onfail=ignore:fifo_format=flv]rtmp://host1/live-restream/demo"
ffmpeg version N-82225-gb4e9252-static http://johnvansickle.com/ffmpeg/
Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.1 (Debian 5.4.1-3) 20161019
  configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gray --enable-libass --enable-libebur128
--enable-libfreetype --enable-libfribidi --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex
--enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 35.100 / 55. 35.100
  libavcodec     57. 66.101 / 57. 66.101
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 66.100 /  6. 66.100
  libswscale      4.  3.100 /  4.  3.100
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[h264 @ 0x586ebc0] Reinit context to 512x288, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf56.26.101
    comment         : Creative Commons Attribution 3.0 -
http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:10:34.63, start: 0.000000, bitrate: 743 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline), 1 reference frame
(avc1 / 0x31637661), yuv420p(left), 512x288 [SAR 1:1 DAR 16:9], 640 kb/s,
30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 96 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[Parsed_scale_0 @ 0x598a180] w:-2 h:320 flags:'bicubic' interl:0
[Parsed_fps_1 @ 0x5989e20] fps=30/1
[graph 0 input from stream 0:0 @ 0x5989ac0] w:512 h:288 pixfmt:yuv420p
tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
[Parsed_scale_0 @ 0x598a180] w:512 h:288 fmt:yuv420p sar:1/1 -> w:568 h:320
fmt:yuv420p sar:640/639 flags:0x4
[graph 1 input from stream 0:1 @ 0x596df80] tb:1/48000 samplefmt:fltp
samplerate:48000 chlayout:0x3
[audio format for output stream 0:1 @ 0x596eae0] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the
filter 'audio format for output stream 0:1'
[auto-inserted resampler 0 @ 0x5970aa0] ch:2 chl:stereo fmt:fltp r:48000Hz
-> ch:2 chl:stereo fmt:fltp r:44100Hz
[libx264 @ 0x5988160] using SAR=640/639
[libx264 @ 0x5988160] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x5988160] profile Constrained Baseline, level 3.0
[tee @ 0x58720a0] filename:'rtmp://host1/live-restream/demo' format:fifo
[tee @ 0x58720a0]     stream:0 codec:h264 type:video bsfs: null
[tee @ 0x58720a0]     stream:1 codec:aac type:audio bsfs: null
Output #0, tee, to
'[f=fifo:onfail=ignore:fifo_format=flv]rtmp://host1/live-restream/demo':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 -
http://bbb3d.renderfarming.net
    encoder         : Lavf57.57.100
Parsing...
    Stream #0:0(und): Video: h264 (libx264), 1 reference frame,
yuv420p(left), 568x320 [SAR 640:639 DAR 16:9], q=-1--1, 30 fps, 30 tbn, 30
tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.66.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 256000/0/0 buffer size: 256000 vbv_delay: -1
Parsed protocol: 0
Parsed host    : host1
    Stream #0:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, delay 1024,
256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.66.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Parsed app     : live-restream
Press [q] to stop, [?] for help
[h264 @ 0x5985d40] Reinit context to 512x288, pix_fmt: yuv420p
RTMP_Connect1, ... connected, handshaking
HandShake: Type Answer   : 03
HandShake: Server Uptime : 96850052
HandShake: FMS Version   : 3.0.1.1
HandShake: Handshaking finished....
RTMP_Connect1, handshaked
Invoking connect
HandleServerBW: server BW = 2500000
HandleClientBW: client BW = 2500000 2
HandleCtrl, received ctrl. type: 0, len: 6
HandleCtrl, Stream Begin 0
HandleChangeChunkSize, received: chunk size change to 512
RTMP_ClientPacket, received: invoke 261 bytes
(object begin)
Property: <Name:           no-name., STRING:    _result>
Property: <Name:           no-name., NUMBER:    1.00>
Property: <Name:           no-name., OBJECT>
(object begin)
Property: <Name:             fmsVer, STRING:    FMS/3,5,7,7009>
Property: <Name:       capabilities, NUMBER:    31.00>
Property: <Name:               mode, NUMBER:    1.00>
(object end)
Property: <Name:           no-name., OBJECT>
(object begin)
Property: <Name:              level, STRING:    status>
Property: <Name:               code, STRING:
NetConnection.Connect.Success>
Property: <Name:        description, STRING:    Connection succeeded.>
Property: <Name:               data, ECMA_ARRAY>
(object begin)
Property: <Name:            version, STRING:    3,5,7,7009>
(object end)
Property: <Name:           clientid, NUMBER:    124077178.00>
Property: <Name:     objectEncoding, NUMBER:    0.00>
(object end)
(object end)
HandleInvoke, server invoking <_result>
HandleInvoke, received result for method call <connect>
Invoking releaseStream
Invoking FCPublish
Invoking createStream
RTMP_ClientPacket, received: invoke 136 bytes
(object begin)
Property: <Name:           no-name., STRING:    onFCPublish>
Property: <Name:           no-name., NUMBER:    0.00>
Property: NULL
Property: <Name:           no-name., OBJECT>
(object begin)
Property: <Name:              level, STRING:    status>
Property: <Name:               code, STRING:    NetStream.Publish.Start>
Property: <Name:        description, STRING:    FCPublish to stream demo.>
Property: <Name:           clientid, NUMBER:    124077178.00>
(object end)
(object end)
HandleInvoke, server invoking <onFCPublish>
RTMP_ClientPacket, received: invoke 29 bytes
(object begin)
Property: <Name:           no-name., STRING:    _result>
Property: <Name:           no-name., NUMBER:    4.00>
Property: NULL
Property: <Name:           no-name., NUMBER:    1.00>
(object end)
HandleInvoke, server invoking <_result>
HandleInvoke, received result for method call <createStream>
Invoking publish
HandleCtrl, received ctrl. type: 0, len: 6
HandleCtrl, Stream Begin 1
RTMP_ClientPacket, received: invoke 124 bytes
(object begin)
Property: <Name:           no-name., STRING:    onStatus>
Property: <Name:           no-name., NUMBER:    0.00>
Property: NULL
Property: <Name:           no-name., OBJECT>
(object begin)
Property: <Name:              level, STRING:    status>
Property: <Name:               code, STRING:    NetStream.Publish.Start>
Property: <Name:        description, STRING:    Publishing demo.>
Property: <Name:           clientid, NUMBER:    124077178.00>
(object end)
(object end)
HandleInvoke, server invoking <onStatus>
HandleInvoke, onStatus: NetStream.Publish.Start
Larger timestamp than 24-bit: 0xfffffe04=00:00:01.48 bitrate=N/A
speed=0.98x
Invoking FCUnpublish
Invoking deleteStream
frame=   37 fps= 21 q=-1.0 Lsize=N/A time=00:00:01.74 bitrate=N/A
speed=0.989x
video:46kB audio:47kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
Input file #0 (sample.mp4):
  Input stream #0:0 (video): 53 packets read (113854 bytes); 39 frames
decoded;
  Input stream #0:1 (audio): 83 packets read (21298 bytes); 82 frames
decoded (83968 samples);
  Total: 136 packets (135152 bytes) demuxed
Output file #0
([f=fifo:onfail=ignore:fifo_format=flv]rtmp://host1/live-restream/demo):
  Output stream #0:0 (video): 37 frames encoded; 37 packets muxed (47105
bytes);
  Output stream #0:1 (audio): 75 frames encoded (76800 samples); 76 packets
muxed (48175 bytes);
  Total: 113 packets (95280 bytes) muxed
[Parsed_fps_1 @ 0x5989e20] 39 frames in, 38 frames out; 1 frames dropped, 0
frames duplicated.
[libx264 @ 0x5988160] frame I:1     Avg QP:20.00  size:  1282
[libx264 @ 0x5988160] frame P:36    Avg QP:26.94  size:  1273
[libx264 @ 0x5988160] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x5988160] mb P  I16..4: 17.7%  0.0%  0.0%  P16..4:  5.4%  0.0%
0.0%  0.0%  0.0%    skip:77.0%
[libx264 @ 0x5988160] coded y,uvDC,uvAC intra: 12.0% 16.0% 12.9% inter:
3.1% 5.0% 3.1%
[libx264 @ 0x5988160] i16 v,h,dc,p: 85%  8%  6%  1%
[libx264 @ 0x5988160] i8c dc,h,v,p: 81%  9%  9%  1%
[libx264 @ 0x5988160] kb/s:305.55
[aac @ 0x58bc060] Qavg: 24997.105


More information about the ffmpeg-user mailing list