Opened 4 years ago

Closed 3 years ago

#59750 closed defect (fixed)

ffmpeg and ffmpeg-devel immediately crash with segfault 11 when input is mp4

Reported by: fdik (Volker Birk) Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: Cc: jeremyhu (Jeremy Huddleston Sequoia), SpikeLightfoot, rubendibattista (Ruben Di Battista)
Port: ffmpeg

Description (last modified by mf2k (Frank Schima))

Sample (crashes with all .mp4):

ffmpeg version 4.2.git Copyright (c) 2000-2019 the FFmpeg developers
  built with clang version 9.0.0 (tags/RELEASE_900/final)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-librsvg --enable-libtheora --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-libjack --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-indev=jack --enable-opencl --disable-outdev=xv --enable-audiotoolbox --enable-videotoolbox --enable-sdl2 --disable-securetransport --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/opt/local/bin/clang-mp-9.0 --arch=x86_64 --enable-x86asm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid --enable-nonfree --enable-libfdk-aac
  libavutil      56. 35.100 / 56. 35.100
  libavcodec     58. 59.101 / 58. 59.101
  libavformat    58. 33.100 / 58. 33.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 61.100 /  7. 61.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BlackRock_Vortrag.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2019-11-17T17:57:34.000000Z
  Duration: 01:14:37.25, start: 0.000000, bitrate: 6159 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 5998 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2019-11-17T17:57:34.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 157 kb/s (default)
    Metadata:
      creation_time   : 2019-11-17T17:57:34.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
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
[1]    29329 segmentation fault  ffmpeg -i BlackRock_Vortrag.mp4 BlackRock_Vortrag-x.mp4

Change History (17)

comment:1 Changed 4 years ago by fdik (Volker Birk)

I tried different compile options +nonfree etc., but I cannot find a combination where it does not crash.

comment:2 Changed 4 years ago by mf2k (Frank Schima)

In the future, please use WikiFormatting.

comment:3 Changed 4 years ago by mf2k (Frank Schima)

Cc: dbevans removed
Description: modified (diff)
Keywords: ffmpeg segfault mp4 removed
Owner: set to dbevans
Status: newassigned

comment:4 Changed 4 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

I cannot reproduce this problem.
I tried a few different mp4 files, and ffmpeg -i XXX.mp4 out.mp4 works.

This is just a guess, but perhaps FFmpeg suffers from the -fno-stack-check bug.
The bug seems to have been fixed in Xcode 11.3.
After upgrading to the latest Xcode and Command Line Tools, I suggest you try to rebuild ffmpeg from source to see what happens.

comment:5 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Also, please attach the crash log; it may tell us why it crashed.

comment:6 Changed 4 years ago by rubendibattista (Ruben Di Battista)

In ab2056ca1b07d1dbc159473994516909a33b451a/macports-ports (master):

x264: Update snapshot

This fixes a segmentation fault on Catalina
See: #59750

comment:7 Changed 4 years ago by Knapoc

This issue seems to be back with Xcode 11.4.

Process:               ffmpeg [47614]
Path:                  /opt/local/bin/ffmpeg
Identifier:            ffmpeg
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        zsh [47583]
Responsible:           Terminal [47581]
User ID:               501

Date/Time:             2020-04-08 20:52:19.184 +0200
OS Version:            Mac OS X 10.15.4 (19E266)
Report Version:        12
Bridge OS Version:     4.4 (17P4263)
Anonymous UUID:        3CC15B59-6933-4AB7-A33C-42BEFCA266A4

Sleep/Wake UUID:       D1C69908-DE07-486A-AB53-F90866D28C25

Time Awake Since Boot: 23000 seconds
Time Since Wake:       5900 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [47614]

Application Specific Information:
dyld2 mode

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libdyld.dylib                 	0x00007fff6f09870a stack_not_16_byte_aligned_error + 0
1   ???                           	0x00007ffee712cb00 0 + 140732775189248
2   libdyld.dylib                 	0x00007fff6f099cc9 start + 1

comment:8 Changed 4 years ago by eirnym (Eir Nym)

I confirm it. Rebuilding from scratch and using use_xcode for every port doesn't help

comment:9 Changed 4 years ago by eirnym (Eir Nym)

In Homebrew and few other projects add an additional compilation flag for ffmpeg to compile:

 ENV.append "CXXFLAGS", "-fno-stack-check"

comment:10 Changed 4 years ago by kencu (Ken)

we can do homebrew one better! -- we have a whole PortGroup to accomplish that! <https://github.com/macports/macports-ports/blob/master/_resources/port1.0/group/xcode_workaround-1.0.tcl>

comment:11 Changed 4 years ago by eirnym (Eir Nym)

@kencu In this case you should maintain white and black lists of Xcode. Maybe in 11.3 the problem was absent, but in 11.4 it's present again and I confirm it.

comment:12 Changed 4 years ago by eirnym (Eir Nym)

Currently I set the "fixed_xcode_version" to 11.5 in my MacPorts. to make sure that it works fine in my environment. If it's an accepted change, I'll prepare a PR

comment:13 Changed 4 years ago by SpikeLightfoot

Cc: SpikeLightfoot added

comment:14 Changed 4 years ago by rubendibattista (Ruben Di Battista)

In ab2056ca1b07d1dbc159473994516909a33b451a/macports-ports (dar, master, py38-reproject, revert-6945-rust-1.43.0, wireshark):

x264: Update snapshot

This fixes a segmentation fault on Catalina
See: #59750

comment:15 Changed 3 years ago by mascguy (Christopher Nielsen)

Cc: rubendibattista added

comment:16 in reply to:  14 Changed 3 years ago by mascguy (Christopher Nielsen)

Replying to rubendibattista:

In ab2056ca1b07d1dbc159473994516909a33b451a/macports-ports (dar, master, py38-reproject, revert-6945-rust-1.43.0, wireshark):

x264: Update snapshot

This fixes a segmentation fault on Catalina
See: #59750

Ruben, given the fix you committed a year ago, is this issue resolved?

Last edited 3 years ago by mascguy (Christopher Nielsen) (previous) (diff)

comment:17 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

Ruben responded by email saying:

I think so, yes!

Note: See TracTickets for help on using tickets.