【问题标题】:compiling ffmpeg for Mac OSX High Sierra 10.13为 Mac OSX High Sierra 10.13 编译 ffmpeg
【发布时间】:2021-07-29 15:30:18
【问题描述】:

您好,我制作了一个使用 ffmpeg 组合音频和渲染视频的电子应用程序,它在 windows、linux 和现代 mac osx 计算机上运行良好,但用户向我报告说,在旧版本的 mac osx 上,例如High Sierra 10.13,我设置 ffmpeg 的方式不起作用。

我有一个带有 High Sierra v10.13 的虚拟机,我从 RenderTune releases page 安装 RenderTune-mac.dmg,然后我从 this link 下载 2 个音频文件和图像。我打开 RenderTune,然后尝试渲染视频。我将音频文件合并为单个 mp3 的命令工作正常,但是当我尝试将该 mp3 与图像文件合并时,我与电子应用程序打包的 ffmpeg 构建失败并出现此错误:

Command was killed with SIGABRT (Aborted): /Applications/RenderTune.app/Contents/Resources/ffmpeg -loop 1 -framerate 2 -i /Users/martin/Downloads/R-3777978-1344032418-8379.jpeg.jpg -i /Users/martin/Downloads/output-871140.mp3 -y -acodec copy -b:a 320k -vcodec libx264 -b:v 8000k -maxrate 8000k -minrate 8000k -bufsize 3M -filter:v scale=w=1920:h=1954 -preset medium -tune stillimage -crf 18 -pix_fmt yuv420p -shortest /Users/martin/Downloads/concatVideo-871140.mp4
ffmpeg version git-2021-03-24-13335df Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
  configuration: --pkgconfigdir=/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace/lib/pkgconfig --prefix=/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace --pkg-config-flags=--static --extra-cflags='-I/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace/include -mmacosx-version-min=10.10' --extra-ldflags='-L/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace/lib -mmacosx-version-min=10.10' --extra-libs='-lpthread -lm' --enable-static --disable-securetransport --disable-debug --disable-shared --disable-ffplay --disable-lzma --disable-doc --enable-version3 --enable-pthreads --enable-runtime-cpudetect --enable-avfilter --enable-filters --disable-libxcb --enable-gpl --enable-nonfree --disable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libx264
  libavutil      56. 66.100 / 56. 66.100
  libavcodec     58.128.100 / 58.128.100
  libavformat    58. 69.100 / 58. 69.100
  libavdevice    58. 12.100 / 58. 12.100
  libavfilter     7.107.100 /  7.107.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, image2, from '/Users/martin/Downloads/R-3777978-1344032418-8379.jpeg.jpg':
  Duration: 00:00:00.50, start: 0.000000, bitrate: 1758 kb/s
  Stream #0:0: Video: mjpeg (Progressive), yuvj444p(pc, bt470bg/unknown/unknown), 590x600 [SAR 1:1 DAR 59:60], 2 fps, 2 tbr, 2 tbn, 2 tbc
Input #1, mp3, from '/Users/martin/Downloads/output-871140.mp3':
  Metadata:
    title           : My Little Grass Shack
    album           : Our Hawaii - A Collection Of Personal Favorites
    artist          : Society Of Seven
    track           : 11
    encoder         : Lavf58.69.100
  Duration: 00:06:25.59, start: 0.025057, bitrate: 320 kb/s
  Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
    Metadata:
      encoder         : Lavc58.12
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[swscaler @ 0x7fbad9167600] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x7fbad9040400] using SAR=2681/2679
dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
  Referenced from: /Applications/RenderTune.app/Contents/Resources/ffmpeg
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ____chkstk_darwin
  Referenced from: /Applications/RenderTune.app/Contents/Resources/ffmpeg
  Expected in: /usr/lib/libSystem.B.dylib

    at makeError (/Applications/Render…eca/lib/error.js:59)
    at handlePromise (/Applications/Render…/execa/index.js:114)
    at async file:/Applicat…js/newindex.js:1323

这些文件可以在 windows/linux 和最近的 mac 版本上正常显示。为了在我的 mac 计算机上的电子应用程序中打包 ffmpeg,我必须构建一个没有动态链接库的自定义沙盒版本。我有一个 .sh 文件,它会自动下载 ffmpeg 并使用 mac 计算机的所有必要标志构建它。 https://github.com/MartinBarker/RenderTune/blob/master/buildffmpeg.sh 在这个 .sh 文件中,我使用这些标志编译 ffmpeg:

./configure \
    --pkgconfigdir="$WORKSPACE/lib/pkgconfig" \
    --prefix=${WORKSPACE} \
    --pkg-config-flags="--static" \
    --extra-cflags="-I$WORKSPACE/include -mmacosx-version-min=${MACOS_MIN}" \
    --extra-ldflags="-L$WORKSPACE/lib -mmacosx-version-min=${MACOS_MIN}" \
    --extra-libs="-lpthread -lm" \
        --enable-static \
        --disable-securetransport \
        --disable-debug \
        --disable-shared \
        --disable-ffplay \
        --disable-lzma \
        --disable-doc \
        --enable-version3 \
        --enable-pthreads \
        --enable-runtime-cpudetect \
        --enable-avfilter \
        --enable-filters \
        --disable-libxcb \
        --enable-gpl \
        --enable-nonfree \
        --disable-libass \
        --enable-libfdk-aac \
        --enable-libmp3lame \
        --enable-libx264 

如果我尝试在我的 High Sierra 虚拟机中运行此脚本,则会失败并显示以下消息:

Unknown option "-extra-libs=-lpthread"

如果我删除该标志,它会失败并显示不同的消息:

Unknown option "--enable-static"

我需要这个标志才能在 mac apple store 上发布我的电子应用程序,谁能帮我编译一个静态版本的 ffmpeg,它可以在 High Sierra 10.13 等旧版本上运行,也可以在现代 mac os 上运行系统?

【问题讨论】:

  • 带有--enable-nonfree 的ffmpeg 是不可再分发的。
  • 无论有没有--enable-nonfree,此票证中的问题仍然存在
  • 只是评论,与问题无关。

标签: macos ffmpeg compiler-errors electron macos-high-sierra


【解决方案1】:

如果您支持多个操作系统及其不同版本,您将需要多个版本。我通过编译 AdoptOpenJDK 然后编译 FFmpeg 2.8 在 High Sierra 10.13 上成功编译了 FFmpeg。我手动使用了homebrew,现在将自动使用网络请求下载静态版本。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2017-11-17
  • 2018-05-02
  • 2018-04-02
  • 1970-01-01
  • 2018-05-02
  • 2018-03-09
  • 2018-03-06
  • 2018-03-18
相关资源
最近更新 更多