Search code examples
nativescript

Can't install nativescript-ffmpeg-plugin on nativescript


Running ns plugin add nativescript-ffmpeg-plugin produces the following error.

> nativescript-ffmpeg-plugin@0.0.2 postinstall /Users/.../websites/test/ffmpeg/node_modules/nativescript-ffmpeg-plugin
> node postinstall-hooks.js

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'nativescript-hook'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/.../websites/test/ffmpeg/node_modules/nativescript-ffmpeg-plugin/postinstall-hooks.js:1:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Manually installing nativescript-hook (i.e. npm i nativescript-hook --save-dev) allows this plugin to be installed, but attempting to build the app on iOS fails with the following error:

Undefined symbols for architecture x86_64:
  "_CVPixelBufferRetain", referenced from:
      _videotoolbox_decoder_callback in libavcodec.a(videotoolbox.o)
  "_CVPixelBufferRelease", referenced from:
      _videotoolbox_buffer_release in libavcodec.a(videotoolbox.o)
      _ff_videotoolbox_uninit in libavcodec.a(videotoolbox.o)
      _videotoolbox_decoder_callback in libavcodec.a(videotoolbox.o)
      _videotoolbox_common_end_frame in libavcodec.a(videotoolbox.o)
  "_CVPixelBufferPoolCreatePixelBuffer", referenced from:
      _vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
  "_kCVImageBufferPixelAspectRatioHorizontalSpacingKey", referenced from:
      _vtenc_create_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVImageBufferPixelAspectRatioVerticalSpacingKey", referenced from:
      _vtenc_create_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVImageBufferGammaLevelKey", referenced from:
      _vtenc_create_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVPixelBufferWidthKey", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
      _videotoolbox_start in libavcodec.a(videotoolbox.o)
  "_kCVPixelBufferHeightKey", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
      _videotoolbox_start in libavcodec.a(videotoolbox.o)
  "_kCVImageBufferTransferFunction_UseGamma", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVImageBufferYCbCrMatrix_ITU_R_709_2", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVImageBufferTransferFunction_SMPTE_240M_1995", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVPixelBufferPixelFormatTypeKey", referenced from:
      _avf_read_header in libavdevice.a(avfoundation.o)
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
      _videotoolbox_start in libavcodec.a(videotoolbox.o)
  "_kCVImageBufferTransferFunction_ITU_R_709_2", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVImageBufferColorPrimaries_ITU_R_709_2", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVImageBufferYCbCrMatrix_SMPTE_240M_1995", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_CVPixelBufferGetDataSize", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
  "_CVPixelBufferGetPixelFormatType", referenced from:
      _videotoolbox_common_end_frame in libavcodec.a(videotoolbox.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
      _videotoolbox_retrieve_data in MobileFFmpeg.a(libmobileffmpeg_la-fftools_ffmpeg_videotoolbox.o)
  "_kCVPixelBufferOpenGLESCompatibilityKey", referenced from:
      _videotoolbox_start in libavcodec.a(videotoolbox.o)
  "_CVPixelBufferLockBaseAddress", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
      _videotoolbox_retrieve_data in MobileFFmpeg.a(libmobileffmpeg_la-fftools_ffmpeg_videotoolbox.o)
  "_kCVImageBufferTransferFunctionKey", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_CVPixelBufferIsPlanar", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
      _videotoolbox_retrieve_data in MobileFFmpeg.a(libmobileffmpeg_la-fftools_ffmpeg_videotoolbox.o)
  "_kCVImageBufferYCbCrMatrixKey", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_CVPixelBufferGetWidth", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _videotoolbox_common_end_frame in libavcodec.a(videotoolbox.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
  "_CVPixelBufferGetBaseAddressOfPlane", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
      _videotoolbox_retrieve_data in MobileFFmpeg.a(libmobileffmpeg_la-fftools_ffmpeg_videotoolbox.o)
  "_CVPixelBufferGetBytesPerRowOfPlane", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
      _videotoolbox_retrieve_data in MobileFFmpeg.a(libmobileffmpeg_la-fftools_ffmpeg_videotoolbox.o)
  "_CVPixelBufferGetBytesPerRow", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
      _videotoolbox_retrieve_data in MobileFFmpeg.a(libmobileffmpeg_la-fftools_ffmpeg_videotoolbox.o)
  "_CVPixelBufferGetBaseAddress", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
      _videotoolbox_retrieve_data in MobileFFmpeg.a(libmobileffmpeg_la-fftools_ffmpeg_videotoolbox.o)
  "_CVPixelBufferGetHeight", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _videotoolbox_common_end_frame in libavcodec.a(videotoolbox.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
  "_CVPixelBufferGetPlaneCount", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
      _videotoolbox_retrieve_data in MobileFFmpeg.a(libmobileffmpeg_la-fftools_ffmpeg_videotoolbox.o)
  "_kCVImageBufferColorPrimariesKey", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVImageBufferYCbCrMatrix_ITU_R_601_4", referenced from:
      _vtenc_configure_encoder in libavcodec.a(videotoolboxenc.o)
  "_kCVPixelBufferIOSurfacePropertiesKey", referenced from:
      _videotoolbox_start in libavcodec.a(videotoolbox.o)
  "_CVPixelBufferUnlockBaseAddress", referenced from:
      _avf_read_packet in libavdevice.a(avfoundation.o)
      _vtenc_send_frame in libavcodec.a(videotoolboxenc.o)
      _vt_map_frame in libavutil.a(hwcontext_videotoolbox.o)
      _vt_unmap in libavutil.a(hwcontext_videotoolbox.o)
      _videotoolbox_retrieve_data in MobileFFmpeg.a(libmobileffmpeg_la-fftools_ffmpeg_videotoolbox.o)
  "_CVImageBufferGetEncodedSize", referenced from:
      _avf_read_header in libavdevice.a(avfoundation.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I tried this on:

  • Mac development environment
  • iOS 14
  • emulator: iPhone 8

Nativescript details:

  • CLI: 7.0.8
  • Cross-platform modules: 7.0.5
  • Runtime(s): 7.0.0
  • Plugin(s):
  "dependencies": {
    "@nativescript/core": "~7.0.0",
    "@nativescript/theme": "~2.3.0",
    "nativescript-ffmpeg-plugin": "0.0.2",
    "nativescript-vue": "~2.8.1"
  },
  "devDependencies": {
    "@babel/core": "~7.11.6",
    "@babel/preset-env": "~7.11.5",
    "@nativescript/ios": "7.0.0",
    "@nativescript/webpack": "~3.0.3",
    "babel-loader": "~8.1.0",
    "nativescript-hook": "^0.2.5",
    "nativescript-vue-template-compiler": "~2.8.1",
    "node-sass": "^4.14.1",
    "vue-loader": "~15.9.3"
  },

You can easily recreate the issue by doing the following:

ns create ffmpeg --vue
cd ffmpeg
npm i nativescript-hook --save-dev
ns plugin add nativescript-ffmpeg-plugin
npm run debug-ios

Has anyone successfully installed the plugin recently and have any tips for getting around these issues?


Solution

  • I installed nativescript-ffmpeg-plugin-fixed which has worked without issue on NS7.