Opened 5 years ago

Closed 5 years ago

#675 closed defect (fixed)

ffmpeg crash when streaming non-audio-containing file to ffserver

Reported by: teratorn Owned by: michael
Priority: normal Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Apparently there is a problem trying to stream a file that does not contain an audio stream to ffserver. I'm using the default sample ffserver.conf and running ffserver like so:

ffserver -f doc/ffserver.conf

Then I try to stream the source media to ffserver like so:

ffmpeg -i out.mpg http://localhost:8090/feed1.ffm

On git master this seems to segfault reliably:

Hickory ~/code-other/ffmpeg % gdb --args ffmpeg -i test.mpg http://localhost:8090/feed1.ffm
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/teratorn/code-other/ffmpeg/ffmpeg...done.
(gdb) r
Starting program: /home/teratorn/code-other/ffmpeg/ffmpeg -i test.mpg http://localhost:8090/feed1.ffm
[Thread debugging using libthread_db enabled]
ffmpeg version N-35061-g4931c8f, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov 21 2011 11:03:26 with gcc 4.4.5
  configuration: --prefix=/home/teratorn/altsys --enable-shared --enable-gpl --enable-libx264 --enable-debug --disable-stripping --disable-asm --optflags=-O0
  libavutil    51. 26. 0 / 51. 26. 0
  libavcodec   53. 36. 0 / 53. 36. 0
  libavformat  53. 21. 0 / 53. 21. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 49. 0 /  2. 49. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mpeg @ 0x627710] max_analyze_duration 5000000 reached at 5005000
Input #0, mpeg, from 'test.mpg':
  Duration: 00:00:06.84, start: 1.000000, bitrate: 469 kb/s
    Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p, 320x240 [SAR 200:219 DAR 800:657], 104857 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 29.97 tbc
[buffer @ 0x62f960] w:320 h:240 pixfmt:yuv420p tb:1/1000000 sar:200/219 sws_param:
[scale @ 0x63e7a0] w:320 h:240 fmt:yuv420p -> w:160 h:128 fmt:yuv420p flags:0x4
[buffer @ 0x62d470] w:320 h:240 pixfmt:yuv420p tb:1/1000000 sar:200/219 sws_param:
[scale @ 0x6548d0] w:320 h:240 fmt:yuv420p -> w:352 h:240 fmt:yuv420p flags:0x4
[mp2 @ 0x63e950] codec type or id mismatches
Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
    Stream #0:0: Audio: mp2, 44100 Hz, 1 channels, s16, 32 kb/s
    Stream #0:1: Video: mpeg1video, yuv420p, 160x128 [SAR 640:657 DAR 800:657], q=2-31, 64 kb/s, 1000k tbn, 29.97 tbc
    Stream #0:2: Audio: wmav2, 22050 Hz, 1 channels, s16, 64 kb/s
    Stream #0:3: Video: msmpeg4, yuv420p, 352x240 [SAR 2000:2409 DAR 800:657], q=2-31, 256 kb/s, 1000k tbn, 29.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0
Program received signal SIGSEGV, Segmentation fault.
0x000000000040e039 in transcode_init (output_files=0x629c50, nb_output_files=1, input_files=0x62fc50, nb_input_files=1) at ffmpeg.c:2455
2455	                   ost->sync_ist->st->index);
(gdb) bt
#0  0x000000000040e039 in transcode_init (output_files=0x629c50, nb_output_files=1, input_files=0x62fc50, nb_input_files=1) at ffmpeg.c:2455
#1  0x000000000040e259 in transcode (output_files=0x629c50, nb_output_files=1, input_files=0x62fc50, nb_input_files=1) at ffmpeg.c:2495
#2  0x0000000000417619 in main (argc=4, argv=0x7fffffffe378) at ffmpeg.c:4760
(gdb) print ost
$1 = (OutputStream *) 0x690e70
(gdb) print ost->sync_ist
$2 = (struct InputStream *) 0x0
(gdb) 

But on the last release, 0.8.6, it produces a nice error message instead:

Hickory ~/code-other/ffmpeg % ffmpeg -i out.mpg http://localhost:8090/feed1.ffm
ffmpeg version 93ade97, Copyright (c) 2000-2011 the Libav developers
  built on Nov 21 2011 15:32:52 with gcc 4.4.5
  configuration: --prefix=/home/teratorn/altsys --enable-shared --enable-gpl --enable-libx264 --enable-debug --disable-asm --disable-optimizations --disable-doc
  libavutil    51.  8. 0 / 51.  8. 0
  libavcodec   53.  5. 0 / 53.  5. 0
  libavformat  53.  2. 0 / 53.  2. 0
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2.  4. 0 /  2.  4. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  52.  0. 0 / 52.  0. 0
[mpeg @ 0x11f9380] max_analyze_duration reached
Input #0, mpeg, from 'out.mpg':
  Duration: 00:00:06.84, start: 1.000000, bitrate: 438 kb/s
    Stream #0.0[0x1e0]: Video: mpeg1video, yuv420p, 320x240 [PAR 200:219 DAR 800:657], 104857 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 29.97 tbc
Incompatible sample format '(null)' for codec 'mp2', auto-selecting format 's16'
Mon Nov 21 15:50:00 2011 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4149
    Last message repeated 1 times
Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
    Stream #0.0: Audio: mp2, 44100 Hz, 1 channels, s16, 32 kb/s
    Stream #0.1: Video: mpeg1video, yuv420p, 160x128, q=2-31, 64 kb/s, 1000k tbn, 3 tbc
    Stream #0.2: Audio: mp2, 22050 Hz, 1 channels, s16, 64 kb/s
    Stream #0.3: Video: msmpeg4, yuv420p, 352x240, q=2-31, 256 kb/s, 1000k tbn, 15 tbc
Could not find input stream matching output stream #0.0
Mon Nov 21 15:50:00 2011 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 0

So I wrote a bisect script (attached) and ran it with

git bisect start master n0.8.6
git bisect run ./do_bisect.sh

It seems to have found the commit which introduced the crash - but I haven't examined this commit or tried to debug it further.

1cede1d0112b5b26e6d023846729662b7cf1853f is the first bad commit
commit 1cede1d0112b5b26e6d023846729662b7cf1853f
Author: Anton Khirnov <anton@khirnov.net>
Date:   Sat Jun 25 07:43:49 2011 +0200

    ffmpeg: factor common code from new_a/v/s/d_stream to new_output_stream()

:100644 100644 fe8b3446b8b0221204ea8d1a1244692a9b145d33 91cfb80b148c778462af673cd9779e57fde44301 M	ffmpeg.c

Is the problem obvious to anyone? Let me know if there is anything else I can provide.

Thanks,

Eric Mangold
Senior Engineer - Cattura Video

Attachments (1)

do_bisect.sh (1.1 KB) - added by teratorn 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by teratorn

comment:1 Changed 5 years ago by michael

  • Reproduced by developer set
  • Resolution set to fixed
  • Status changed from new to closed

Locally fixed, will be in master in a moment assuming tests pass

Note: See TracTickets for help on using tickets.