jonataslaw / VideoCompress

Compress videos, remove audio, manipulate thumbnails, and make your video compatible with all platforms through this lightweight and efficient library.
MIT License
228 stars 267 forks source link

video_compress/SwiftVideoCompressPlugin.swift:194: Fatal error: Unexpectedly found nil while unwrapping an Optional value #109

Open getpu opened 3 years ago

getpu commented 3 years ago

video_compress/SwiftVideoCompressPlugin.swift:194: Fatal error: Unexpectedly found nil while unwrapping an Optional value Lost connection to device.

This the latest version bug under the ios 14.5

mrcsilverfox commented 3 years ago

I tried on an iPhone with iOS 14.2 and sometimes it works other times I get the above error with several video with same extension .mov. Optional(Error Domain=AVFoundationErrorDomain Code=-11829 "Cannot Open" UserInfo={NSUnderlyingError=0x281321c20 {Error Domain=NSOSStatusErrorDomain Code=-12848 "(null)"}, NSLocalizedFailureReason=This media may be damaged., NSURL=file:///private/var/mobile/Containers/Data/Application/../tmp/.video/IMG_0589.MOV, NSLocalizedDescription=Cannot Open})

rignaneseleo commented 3 years ago

Same type of error on iOS 14.5:

2021-06-08 12:00:41.620932+0200 Runner[2420:1742265] flutter: Input file /private/var/mobile/Containers/Data/Application/519B17C5-D79D-4133-8687-466D6B40B02C/tmp/.video/IMG_5495.MOV [size: 4597030] 2021-06-08 12:00:41.621406+0200 Runner[2420:1742265] flutter: verbose: Compressing MOV video... 2021-06-08 12:00:41.621950+0200 Runner[2420:1742265] flutter: VideoCompress: You can try to subscribe to the 2021-06-08 12:00:41.622242+0200 Runner[2420:1742265] flutter: compressProgress$ stream to know the compressing state. Fatal error: Unexpectedly found nil while unwrapping an Optional value: file video_compress/SwiftVideoCompressPlugin.swift, line 194 2021-06-08 12:00:41.652250+0200 Runner[2420:1742078] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file video_compress/SwiftVideoCompressPlugin.swift, line 194

When it happens it freezes the screen.

duonghainbs commented 3 years ago

Does anyone know how to fix this error, I don't know the swift code so I'm stuck. IOS 14.6 compress mov -> mp4

yanivshaked commented 3 years ago

Any update on this issue, or suggested workaround? @jonataslaw Your help here is highly appriciated

video_compress/SwiftVideoCompressPlugin.swift:194: Fatal error: Unexpectedly found nil while unwrapping an Optional value
video_compress/SwiftVideoCompressPlugin.swift:194: Fatal error: Unexpectedly found nil while unwrapping an Optional value
* thread #1, queue = 'com.apple.main-thread', stop reason = Fatal error: Unexpectedly found nil while unwrapping an Optional value
    frame #0: 0x00000001ad8bf060 libswiftCore.dylib`_swift_runtime_on_report
libswiftCore.dylib`_swift_runtime_on_report:
->  0x1ad8bf060 <+0>: ret    
libswiftCore.dylib`_swift_reportToDebugger:
    0x1ad8bf064 <+0>: b      0x1ad8bf060               ; _swift_runtime_on_report
libswiftCore.dylib`_swift_shouldReportFatalErrorsToDebugger:
    0x1ad8bf068 <+0>: adrp   x8, 324119
    0x1ad8bf06c <+4>: ldrb   w0, [x8, #0xa11]
Target 0: (Runner) stopped.
Lost connection to device.
yanivshaked commented 3 years ago

This issue is solved by replacing AssetEntity.file with AssetEntity.originFile from the picker, before providing it to the video compressor.

markmusic27 commented 2 years ago

Having the same issue here. Just a quick question, where are you changing AssetEntity.file? What picker are you referring to?

nihkilft123 commented 1 year ago

Same error arrived when started compressing MP4 video in iOS XR Black phone. stopping recording video_compress/SwiftVideoCompressPlugin.swift:203: Fatal error: Unexpectedly found nil while unwrapping an Optional value

And @yanivshaked can you tell us where can change that AssetEntity.file? in flutter library? or else where?

adigujjar commented 1 year ago

Same error

video_compress/SwiftVideoCompressPlugin.swift:203: Fatal error: Unexpectedly found nil while unwrapping an Optional value video_compress/SwiftVideoCompressPlugin.swift:203: Fatal error: Unexpectedly found nil while unwrapping an Optional value