react-native-compressor icon indicating copy to clipboard operation
react-native-compressor copied to clipboard

Black video after compression

Open NiklasLehnfeld opened this issue 3 years ago • 9 comments

Current behavior

After compression video has codecs: AAC, H.263. Therefore it cannot be played by videoplayer in webapp. Format is .mp4

Expected behavior

Video has codecs: AAC, H.264 and can be played in a videoplayer in webapp.

Platform

  • [X] Android
  • [ ] iOS

React Native Version

v.0.66.4

React Native Compressor Version

v1.5.1

Reproducible Steps And Demo

Reproducible with a Lenovo M10 Tab.

Notes

Unfortunately we also cannot reproduce that issue. We just got that issue from a user. The video cannot be played by any web application. But can be played by QuickTime or Windows Media Player. After opening the video in QuickTime and exporting it again, the codec changed from AAC, H.263 to AAC, H.264. And then it is working fine within the web applications. For that user its always reproducible.

We are using the compression simply like:

await Video.compress(mediaFile.uri, {
    compressionMethod: 'auto',
});

NiklasLehnfeld avatar Feb 16 '22 14:02 NiklasLehnfeld

@NiklasLehnfeld I will investigate. but videos are playing for web on my side.

numandev1 avatar Feb 17 '22 05:02 numandev1

@nomi9995 Any updates on this one? We were able to confirm that it's definetly the compression that changes the video codec.

timges avatar Feb 21 '22 11:02 timges

@timges I am too much. busy in office work, maybe I will investigate and add this in 3 to 4 days.

numandev1 avatar Feb 22 '22 05:02 numandev1

Additional info: Dimensions becomes 144 x 176 for the resultant video, compression mode: auto.

sandeepkallat avatar Mar 02 '22 16:03 sandeepkallat

Hi Numan !! Do you have any update on this issue? :-)

maqboolayaz avatar Mar 07 '22 08:03 maqboolayaz

@maqboolayaz I am too much busy with an office project. hopefully I will try to see it in one or two days.

numandev1 avatar Mar 07 '22 08:03 numandev1

@maqboolayaz @sandeepkallat @timges @NiklasLehnfeld any can provide sample video which is creating this problem. so i can fix it

numandev1 avatar Mar 08 '22 14:03 numandev1

@nomi9995 Unfortunately, we have no source video which converts to H.263, so we are also not able to reproduce it. The issue is in customer's devices because we record live and compress - not upload an existing video. So, what we also know is that the resultant video has Dimension: 144 x 176 and codec AAC, H.263.

Happens only in some phone models like Huawei P30 Pro, Lenovo M10, Samsung A40 etc

sandeepkallat avatar Mar 10 '22 11:03 sandeepkallat

@nomi9995 Not sure if my case is 100% related to this one, but perhaps it can help. I do get a black video after compression, but only on some devices.

The source device for the video recording and compression [compressionMethod: 'auto'] is a LG G6 running Android 9.0. The codec (H264) doesn't seem to change after compression. The compressed video plays fine in other Android devices, but it will show a black screen on iPhones (default media player and WebView), and in Firefox (Linux). It plays correctly in Chromium and VLC (Linux). On a Mac, the compressed video appears in both Safari and Quicktime, but almost completely green colored. In all cases the audio track can be heard.

Here's the original video (very short so that the size < 10MB):

https://user-images.githubusercontent.com/26170770/160455912-bae9f20c-5b0c-4613-8193-d4785fc0ab92.mp4

alariej avatar Mar 28 '22 18:03 alariej

Getting the same issue on my Tecno Pouvoir 4 pro. Black screen after compressing video. Audio not working as well

ValentineCodes avatar Nov 14 '22 07:11 ValentineCodes

I am also seeing this from Android videos

glisom avatar Jan 19 '23 00:01 glisom

@numandev1 any update on this? I would love to use this library but Android videos being unplayable on iOS if they are recorded on Android is pretty much a show stopper. I tried to see how compression was being done, but it appears to rely on a java library that is not on Github anymore.

glisom avatar Jan 19 '23 16:01 glisom

@glisom @NiklasLehnfeld can you help me to reproduce this issue, i wanna fix it on this weekend

numandev1 avatar Aug 24 '23 06:08 numandev1

@numandev1 Sorry, 2 years later I work on a different product and I'm not involved in this anymore.

NiklasLehnfeld avatar Aug 24 '23 07:08 NiklasLehnfeld

@numandev1 sorry, went with different libraries and approach.

glisom avatar Aug 24 '23 13:08 glisom

fixed in the latest version, please feel free to reopen it if you get this issue again

numandev1 avatar Sep 14 '23 22:09 numandev1