[FFmpeg-trac] #2911(undetermined:closed): Seg Fault

FFmpeg trac at avcodec.org
Sun Apr 13 01:21:57 CEST 2014

#2911: Seg Fault
             Reporter:  skyride      |                    Owner:
                 Type:  defect       |                   Status:  closed
             Priority:  normal       |                Component:
              Version:  unspecified  |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |  needs_more_info
Analyzed by developer:  0            |               Blocked By:
                                     |  Reproduced by developer:  0

Comment (by arkanis):

 I also stumbled across the bug described by skyride. I think I found the
 cause and patched it (see below).

 The bug occurred while I was trying to convert an RTMP stream to an HTTP
 stream. The RTMP stream is created with Open Broadcaster Software
 (https://obsproject.com/). The bug does not occur when ffmpeg is used as
 RTMP client!

 Minimal setup to reproduce the bug:

 * Run ffmpeg as RTMP server: ./ffmpeg -listen 1 -i
 rtmp:// -c copy -y test.mp4
 * Open OBS and Stream data to the ffmpeg RTMP server
   * Set Options -> Broadcast Options -> Streaming-Platform to "Custom"
   * Set server to "rtmp://"
   * Start streaming

 Of course you should use your own IP. The used OBS version is v0.613b
 32bit (Windows only). I tested ffmpeg v2.2.1 (on Windows and Linux) and
 the current master branch (e89f3d0ed21259a714a8bd5d05d95af5b1e0f73f on
 Linux). ffmpeg was compiled without librtmp so the native RTMP
 implementation is probably the error source.

 I'll attach detailed ffmpeg and gdb output of these test cases.

 Bug cause and how to fix it:

 The error message "Unable to read command string" lead me to the
 read_connect() function in libavformat/rtmpproto.c. I think the code
 expects the first packet to be an invocation (type RTMP_PT_INVOKE) but OBS
 first sends an RTMP_PT_CHUNK_SIZE packet to increase the chunk size from
 128 bytes to 4096 bytes.

 The attached patch adds code to check for an initial chunk size packet and
 sets the RTMPContexts chunk size accordingly. I tried to replicate the
 coding style as much as possible.

 I'm also not sure if I should post the bug on the development mailing
 list. I hope it's ok here since the ticket already exists.

Ticket URL: <https://trac.ffmpeg.org/ticket/2911#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list