AbedElazizShe / LightCompressor

A powerful and easy-to-use video compression library for android uses MediaCodec API.
Apache License 2.0
537 stars 116 forks source link

Compressed videos don't play on iOS devices #138

Open james04gr opened 2 years ago

james04gr commented 2 years ago

Using the CameraX VideoCapture useCase, when i record a video with setTargetResolution(Size(480, 640)), (whatever quality level compression) the result does not play on iOS devices. It skips the first frames and then it plays (sometimes neither that) If i setTargetResolution(Size(720, 1080)) then it plays.

Why is this happening?

williamleungapptask commented 1 year ago

@AbedElazizShe Hello, I have some video sample that reproduces this issue on iOS and Mac. I only changed the video quality, I tried from very high to low quality, none of them works.

Here is the original one:

https://github.com/AbedElazizShe/LightCompressor/assets/90444219/801f993b-4bea-4633-8fa7-1a01efce8d85

Here is the compressed one:

https://github.com/AbedElazizShe/LightCompressor/assets/90444219/ee1d47d9-f729-4a08-af21-5add4cb7d86f

Here show how those videos play on my Mac:

https://github.com/AbedElazizShe/LightCompressor/assets/90444219/66f11a29-73f9-4785-9bf5-e839966482e3

Hope this helps!

adurandet commented 1 year ago

Hi @AbedElazizShe , I am having the same issue on a Pixel 6. using lightCompressor 1.3.1 :/

williamleungapptask commented 10 months ago

Some new findings, here is the iOS log when playing the video

AddInstanceForFactory: No factory registered for id <CFUUID 0x600002f77080> F8BB1C28-BAE8-11D6-9C31-00039315CD46
ICSInfo.cpp:138  maxSFB long exceeds maximum allowed value
SyntacticElements.cpp:24  Error deserializing ICS info
AACDecoder.cpp:156  Error in deserializing element
AACDecoder.cpp:228  Error deserializing packet
ACMP4AACBaseDecoder.cpp:1,438 (0x7fc585882a40) Error decoding packet 0: err = 18,446,744,073,709,551,615, packet length: 256
ACMP4AACBaseDecoder.cpp:1,447 <data>
ICSInfo.cpp:138  maxSFB long exceeds maximum allowed value
SyntacticElements.cpp:24  Error deserializing ICS info
AACDecoder.cpp:156  Error in deserializing element
AACDecoder.cpp:228  Error deserializing packet
ACMP4AACBaseDecoder.cpp:1,438 (0x7fc585882a40) Error decoding packet 1: err = 18,446,744,073,709,551,615, packet length: 256
ACMP4AACBaseDecoder.cpp:1,447 <data>
ICSInfo.cpp:138  maxSFB long exceeds maximum allowed value
SyntacticElements.cpp:24  Error deserializing ICS info
AACDecoder.cpp:156  Error in deserializing element
AACDecoder.cpp:228  Error deserializing packet
ACMP4AACBaseDecoder.cpp:1,438 (0x7fc585882a40) Error decoding packet 2: err = 18,446,744,073,709,551,615, packet length: 256
ACMP4AACBaseDecoder.cpp:1,447 <data>
ICSInfo.cpp:138  maxSFB long exceeds maximum allowed value
SyntacticElements.cpp:24  Error deserializing ICS info
AACDecoder.cpp:156  Error in deserializing element
AACDecoder.cpp:228  Error deserializing packet
ACMP4AACBaseDecoder.cpp:1,438 (0x7fc585882a40) Error decoding packet 3: err = 18,446,744,073,709,551,615, packet length: 256
ACMP4AACBaseDecoder.cpp:1,447 <data>
AudioQueueObject.cpp:2,459 Prime: Exiting because mConverterError is 1,650,549,857 (0x1000 req, 0x0 primed)
AudioQueueObject.cpp:2,480 Prime: failed (1,650,549,857); will stop (4,096/0 frames)
ICSInfo.cpp:138  maxSFB long exceeds maximum allowed value
SyntacticElements.cpp:24  Error deserializing ICS info
AACDecoder.cpp:156  Error in deserializing element
AACDecoder.cpp:228  Error deserializing packet
ACMP4AACBaseDecoder.cpp:1,438 (0x7fc585882a40) Error decoding packet 4: err = 18,446,744,073,709,551,615, packet length: 256
ACMP4AACBaseDecoder.cpp:1,447 <data>
ICSInfo.cpp:138  maxSFB long exceeds maximum allowed value
SyntacticElements.cpp:24  Error deserializing ICS info
AACDecoder.cpp:156  Error in deserializing element
AACDecoder.cpp:228  Error deserializing packet
ACMP4AACBaseDecoder.cpp:1,438 (0x7fc585882a40) Error decoding packet 0: err = 18,446,744,073,709,551,615, packet length: 256
ACMP4AACBaseDecoder.cpp:1,447 <data>
AudioQueueObject.cpp:2,459 Prime: Exiting because mConverterError is 1,650,549,857 (0x11940 req, 0x0 primed)
AudioQueueObject.cpp:2,480 Prime: failed (1,650,549,857); will stop (72,000/0 frames)
ICSInfo.cpp:138  maxSFB long exceeds maximum allowed value
SyntacticElements.cpp:24  Error deserializing ICS info
AACDecoder.cpp:156  Error in deserializing element
AACDecoder.cpp:228  Error deserializing packet
ACMP4AACBaseDecoder.cpp:1,438 (0x7fc585882a40) Error decoding packet 1: err = 18,446,744,073,709,551,615, packet length: 256
ACMP4AACBaseDecoder.cpp:1,447 <data>

I figured out it could be an audio issue, I disable audio in the compress config and the video is fully playable on iOS and Mac without frame skipping. So in my case it could be the problem of the audio encoder.