[FFmpeg-trac] #5779(ffmpeg:new): Segmentation fault when capture webcam frame

FFmpeg trac at avcodec.org
Sun Aug 14 18:24:24 EEST 2016


#5779: Segmentation fault when capture webcam frame
-----------------------------------+---------------------------------------
             Reporter:  laurent22  |                     Type:  defect
               Status:  new        |                 Priority:  important
            Component:  ffmpeg     |                  Version:  unspecified
             Keywords:             |               Blocked By:
             Blocking:             |  Reproduced by developer:  0
Analyzed by developer:  0          |
-----------------------------------+---------------------------------------
 I'm getting a segmentation fault when I try to capture a frame from my
 webcam. The same command used to work fine but now doesn't, I'm not sure
 if it's due to a change in ffmpeg or in my system (I recently applied the
 Windows 10 Anniversary Edition update if that can make a difference).

 I got the Windows build from there: https://ffmpeg.zeranoe.com/builds/

 How to reproduce:
 {{{
 % ffmpeg.exe -y -loglevel trace -f dshow -i video="USB2.0 HD UVC WebCam"
 d:\cap_20160814T154913_552705200.jpg
 }}}

 Output:
 {{{
 ffmpeg version N-81338-g6612d04 Copyright (c) 2000-2016 the FFmpeg
 developers
   built with gcc 5.4.0 (GCC)
   configuration: --enable-gpl --enable-version3 --disable-w32threads
 --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-
 bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-
 gnutls --enable-iconv --ena
 ble-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-
 libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-
 libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-lib
 openjpeg --enable-libopus --enable-librtmp --enable-libschroedinger
 --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora
 --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-
 libvorbis --enable-libvpx
 --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265
 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-
 decklink --enable-zlib
   libavutil      55. 28.100 / 55. 28.100
   libavcodec     57. 51.102 / 57. 51.102
   libavformat    57. 46.101 / 57. 46.101
   libavdevice    57.  0.102 / 57.  0.102
   libavfilter     6. 51.100 /  6. 51.100
   libswscale      4.  1.100 /  4.  1.100
   libswresample   2.  1.100 /  2.  1.100
   libpostproc    54.  0.100 / 54.  0.100
 Splitting the commandline.
 Reading option '-y' ... matched as option 'y' (overwrite output files)
 with argument '1'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument 'trace'.
 Reading option '-f' ... matched as option 'f' (force format) with argument
 'dshow'.
 Reading option '-i' ... matched as input file with argument 'video=USB2.0
 HD UVC WebCam'.
 Reading option 'd:\cap_20160814T154913_552705200.jpg' ... matched as
 output file.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option y (overwrite output files) with argument 1.
 Applying option loglevel (set logging level) with argument trace.
 Successfully parsed a group of options.
 Parsing a group of options: input file video=USB2.0 HD UVC WebCam.
 Applying option f (force format) with argument dshow.
 Successfully parsed a group of options.
 Opening an input file: video=USB2.0 HD UVC WebCam.
 [dshow @ 0000000000e124a0] Selecting pin Capture on video
 }}}

 GDB trace:
 {{{
 (gdb) r -y -loglevel trace -f dshow -i video="USB2.0 HD UVC WebCam"
 d:\cap_20160814T154913_552705200.jpg
 Starting program: d:\Programmes\ffmpeg\bin\ffmpeg_g.exe -y -loglevel trace
 -f dshow -i video="USB2.0 HD UVC WebCam"
 d:\cap_20160814T154913_552705200.jpg
 [New Thread 12988.0x2438]
 warning: `C:\WINDOWS\SYSTEM32\ntdll.dll': Shared library architecture
 i386:x86-64 is not compatible with target architecture i386.
 warning: `C:\WINDOWS\System32\wow64.dll': Shared library architecture
 i386:x86-64 is not compatible with target architecture i386.
 warning: `C:\WINDOWS\System32\wow64win.dll': Shared library architecture
 i386:x86-64 is not compatible with target architecture i386.
 warning: Could not load shared library symbols for WOW64_IMAGE_SECTION.
 Do you need "set solib-search-path" or "set sysroot"?
 warning: Could not load shared library symbols for WOW64_IMAGE_SECTION.
 Do you need "set solib-search-path" or "set sysroot"?
 warning: Could not load shared library symbols for NOT_AN_IMAGE.
 Do you need "set solib-search-path" or "set sysroot"?
 warning: Could not load shared library symbols for NOT_AN_IMAGE.
 Do you need "set solib-search-path" or "set sysroot"?
 warning: `C:\WINDOWS\System32\wow64cpu.dll': Shared library architecture
 i386:x86-64 is not compatible with target architecture i386.
 [New Thread 12988.0x3100]
 [New Thread 12988.0x14fc]
 [New Thread 12988.0x1d9c]
 ffmpeg version N-80614-g7e4e8fd Copyright (c) 2000-2016 the FFmpeg
 developers
   built with gcc 5.3.0 (GCC)
   configuration: --arch=x86 --target-os=mingw32 --cross-
 prefix=/home/rdp/dev/ffmpeg-windows-build-
 helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-
 --pkg-config=pkg-config --disable-w32threads --enable-gpl --enable-libsox
 r --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv
 --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi
 --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-
 libs=-lpng --enable-libvidsta
 b --enable-libx265 --enable-decklink --extra-libs=-loleaut32 --enable-
 libx264 --enable-libxvid --enable-libmp3lame --enable-version3 --enable-
 zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-
 libspeex --enable-libopenjpeg
  --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus
 --enable-frei0r --enable-filter=frei0r --enable-bzlib --enable-libxavs
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-
 amrwbenc --enable-libschroedi
 nger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp
 --enable-libgme --enable-dxva2 --enable-avisynth --enable-gray --enable-
 libopenh264 --enable-nvenc --enable-libmfx --extra-libs=-lpsapi --extra-
 cflags= --enable-stat
 ic --disable-shared --prefix=/home/rdp/dev/ffmpeg-windows-build-
 helpers/sandbox/cross_compilers/mingw-w64-i686/i686-w64-mingw32 --enable-
 runtime-cpudetect
   libavutil      55. 26.100 / 55. 26.100
   libavcodec     57. 46.100 / 57. 46.100
   libavformat    57. 40.101 / 57. 40.101
   libavdevice    57.  0.101 / 57.  0.101
   libavfilter     6. 46.102 /  6. 46.102
   libswscale      4.  1.100 /  4.  1.100
   libswresample   2.  1.100 /  2.  1.100
   libpostproc    54.  0.100 / 54.  0.100
 Splitting the commandline.
 Reading option '-y' ... matched as option 'y' (overwrite output files)
 with argument '1'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument 'trace'.
 Reading option '-f' ... matched as option 'f' (force format) with argument
 'dshow'.
 Reading option '-i' ... matched as input file with argument 'video=USB2.0
 HD UVC WebCam'.
 Reading option 'd:\cap_20160814T154913_552705200.jpg' ... matched as
 output file.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option y (overwrite output files) with argument 1.
 Applying option loglevel (set logging level) with argument trace.
 Successfully parsed a group of options.
 Parsing a group of options: input file video=USB2.0 HD UVC WebCam.
 Applying option f (force format) with argument dshow.
 Successfully parsed a group of options.
 Opening an input file: video=USB2.0 HD UVC WebCam.
 [New Thread 12988.0x301c]
 [New Thread 12988.0x2608]
 [dshow @ 0ae24b20] Selecting pin Capture on video
 [New Thread 12988.0x2a38]
 [Thread 12988.0x2a38 exited with code 0]
 [New Thread 12988.0x6ec]
 [Thread 12988.0x6ec exited with code 0]
 [New Thread 12988.0x1c8]
 [New Thread 12988.0x33c0]
 [New Thread 12988.0x24c0]
 [New Thread 12988.0x84c]
 [New Thread 12988.0x1d14]
 warning: HEAP[ffmpeg_g.exe]:
 warning: Invalid address specified to RtlFreeHeap( 089F0000, 0AE568D0 )

 [New Thread 12988.0x208c]
 dshow passing through packet of type video size   614400 timestamp
 1539965470000 orig timestamp 1539962300000 graph timestamp 1539965470000
 diff 3170000 USB2.0 HD UVC WebCam
 [New Thread 12988.0x2f30]
 [dshow @ 0ae24b20] All info found
 [dshow @ 0ae24b20] stream 0: start_time: 153996.547 duration:
 -922337203685.478
 [dshow @ 0ae24b20] format: start_time: 153996.547 duration:
 -9223372036854.775 bitrate=0 kb/s
 Input #0, dshow, from 'video=USB2.0 HD UVC WebCam':
   Duration: N/A, start: 153996.547000, bitrate: N/A
     Stream #0:0, 1, 1/10000000: Video: rawvideo, 1 reference frame (YUY2 /
 0x32595559), yuyv422, 640x480, 0/1, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
 Successfully opened the file.
 Parsing a group of options: output file
 d:\cap_20160814T154913_552705200.jpg.
 Successfully parsed a group of options.
 Opening an output file: d:\cap_20160814T154913_552705200.jpg.
 Successfully opened the file.
 detected 8 logical cores
 [New Thread 12988.0x588]
 [New Thread 12988.0x1eb8]
 [New Thread 12988.0x1530]
 [New Thread 12988.0x2bf8]
 [New Thread 12988.0x17b0]
 [New Thread 12988.0x2808]
 [New Thread 12988.0x1bdc]
 [New Thread 12988.0x3300]
 [New Thread 12988.0x8b8]
 [graph 0 input from stream 0:0 @ 0ae60580] Setting 'video_size' to value
 '640x480'
 [graph 0 input from stream 0:0 @ 0ae60580] Setting 'pix_fmt' to value '1'
 [graph 0 input from stream 0:0 @ 0ae60580] Setting 'time_base' to value
 '1/10000000'
 [graph 0 input from stream 0:0 @ 0ae60580] Setting 'pixel_aspect' to value
 '0/1'
 [graph 0 input from stream 0:0 @ 0ae60580] Setting 'sws_param' to value
 'flags=2'
 [graph 0 input from stream 0:0 @ 0ae60580] Setting 'frame_rate' to value
 '10000000/333333'
 [graph 0 input from stream 0:0 @ 0ae60580] w:640 h:480 pixfmt:yuyv422
 tb:1/10000000 fr:10000000/333333 sar:0/1 sws_param:flags=2
 [format @ 0ae60ce0] compat: called with args=[yuvj420p|yuvj422p|yuvj444p]
 [format @ 0ae60ce0] Setting 'pix_fmts' to value
 'yuvj420p|yuvj422p|yuvj444p'
 [auto-inserted scaler 0 @ 0ae61b80] Setting 'flags' to value 'bicubic'
 [auto-inserted scaler 0 @ 0ae61b80] w:iw h:ih flags:'bicubic' interl:0
 [format @ 0ae60ce0] auto-inserting filter 'auto-inserted scaler 0' between
 the filter 'Parsed_null_0' and the filter 'format'
 [AVFilterGraph @ 0ae248a0] query_formats: 4 queried, 2 merged, 1 already
 done, 0 delayed
 [auto-inserted scaler 0 @ 0ae61b80] picking yuvj422p out of 3 ref:yuyv422
 alpha:0
 dshow passing through packet of type video size   614400 timestamp
 1539965750000 orig timestamp 1539962620487 graph timestamp 1539965750000
 diff 3129513 USB2.0 HD UVC WebCam
 [swscaler @ 0ae61fc0] deprecated pixel format used, make sure you did set
 range correctly
 [auto-inserted scaler 0 @ 0ae61b80] w:640 h:480 fmt:yuyv422 sar:0/1 ->
 w:640 h:480 fmt:yuvj422p sar:0/1 flags:0x4
 [mjpeg @ 0ae5c380] Forcing thread count to 1 for MJPEG encoding, use
 -thread_type slice or a constant quantizer if you want to use multiple cpu
 cores
 [mjpeg @ 0ae5c380] intra_quant_bias = 96 inter_quant_bias = 0
 [image2 @ 0ae58ca0] Using AVStream.codec to pass codec parameters to
 muxers is deprecated, use AVStream.codecpar instead.
 Output #0, image2, to 'd:\cap_20160814T154913_552705200.jpg':
   Metadata:
     encoder         : Lavf57.40.101
     Stream #0:0, 0, 333333/10000000: Video: mjpeg, 1 reference frame,
 yuvj422p(pc), 640x480, 0/1, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc
     Metadata:
       encoder         : Lavc57.46.100 mjpeg
     Side data:
       cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
 Press [q] to stop, [?] for help
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 [rawvideo @ 0ae58380] PACKET SIZE: 614400, STRIDE: 1280
 Clipping frame in rate conversion by 0.000008
 [file @ 12731d00] Setting default whitelist 'file,crypto'
 [AVIOContext @ 1273e740] Statistics: 0 seeks, 1 writeouts
 [rawvideo @ 0ae58380] PACKET SIZE: 614400, STRIDE: 1280
 Clipping frame in rate conversion by 0.156242
 [image2 @ 0ae58ca0] Could not get frame filename number 2 from pattern
 'd:\cap_20160814T154913_552705200.jpg' (either set updatefirst or use a
 pattern like %03d within the filename pattern)
 av_interleaved_write_frame(): Invalid argument
 No more output streams to write to, finishing.
 frame=    2 fps=0.0 q=2.2 Lsize=N/A time=00:00:00.06 bitrate=N/A
 speed=4.44x
 video:45kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 Input file #0 (video=USB2.0 HD UVC WebCam):
   Input stream #0:0 (video): 2 packets read (1228800 bytes); 2 frames
 decoded;
   Total: 2 packets (1228800 bytes) demuxed
 Output file #0 (d:\cap_20160814T154913_552705200.jpg):
   Output stream #0:0 (video): 2 frames encoded; 2 packets muxed (46478
 bytes);
   Total: 2 packets (46478 bytes) muxed
 2 frames successfully decoded, 0 decoding errors
 [Thread 12988.0x2808 exited with code 0]
 [Thread 12988.0x17b0 exited with code 0]
 [Thread 12988.0x588 exited with code 0]
 [Thread 12988.0x1eb8 exited with code 0]
 [Thread 12988.0x1530 exited with code 0]
 [Thread 12988.0x2bf8 exited with code 0]
 [Thread 12988.0x1bdc exited with code 0]
 dshow passing through packet of type video size   614400 timestamp
 1539966140000 orig timestamp 1539962940701 graph timestamp 1539966140000
 diff 3199299 USB2.0 HD UVC WebCam
 [Thread 12988.0x3300 exited with code 0]
 [Thread 12988.0x8b8 exited with code 0]
 [Thread 12988.0x24c0 exited with code 0]
 [Thread 12988.0x301c exited with code 0]
 [Thread 12988.0x1d14 exited with code 0]
 [Thread 12988.0x208c exited with code 0]
 [Thread 12988.0x2608 exited with code 0]
 [Thread 12988.0x84c exited with code 0]
 [Thread 12988.0x33c0 exited with code 0]
 [Thread 12988.0x1c8 exited with code 0]
 [New Thread 12988.0x2824]
 [Thread 12988.0x2f30 exited with code 0]
 Conversion failed!
 [Thread 12988.0x1d9c exited with code 1]
 [Thread 12988.0x3100 exited with code 1]
 [Thread 12988.0x2824 exited with code 1]
 [Thread 12988.0x14fc exited with code 1]
 [Inferior 1 (process 12988) exited with code 01]
 }}}

 In fact, I've just noticed that, unfortunately, when running in gdb it
 works, though the exact same command outside definitely crashes. If I can
 provide any additional information, please let me know

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5779>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list