react-native-compressor
react-native-compressor copied to clipboard
Black video after compression
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 I will investigate. but videos are playing for web on my side.
@nomi9995 Any updates on this one? We were able to confirm that it's definetly the compression that changes the video codec.
@timges I am too much. busy in office work, maybe I will investigate and add this in 3 to 4 days.
Additional info: Dimensions becomes 144 x 176 for the resultant video, compression mode: auto.
Hi Numan !! Do you have any update on this issue? :-)
@maqboolayaz I am too much busy with an office project. hopefully I will try to see it in one or two days.
@maqboolayaz @sandeepkallat @timges @NiklasLehnfeld any can provide sample video which is creating this problem. so i can fix it
@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
@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
Getting the same issue on my Tecno Pouvoir 4 pro. Black screen after compressing video. Audio not working as well
I am also seeing this from Android videos
@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 @NiklasLehnfeld can you help me to reproduce this issue, i wanna fix it on this weekend
@numandev1 Sorry, 2 years later I work on a different product and I'm not involved in this anymore.
@numandev1 sorry, went with different libraries and approach.
fixed in the latest version, please feel free to reopen it if you get this issue again