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

Video compression breaks video stream compatibility

Open serolgames opened this issue 1 year ago • 17 comments

Hello ! I hope you're doing well.

Sorry to be back with bad news 😅

Maybe there is a workaround but I have the following issue :

In my app I can upload videos to a s3 bucket. And then the videos can be streamed by users in my app. In the concept there is nothing complicated or difficult to set. I put manually a video in my s3 bucket and stream it perfectly in my app. BUT if I use the app to upload videos, then the stream doesn't work and the video needs to be fully loaded before being playable. And that's because of the compression. I tried with compression ❌ no streaming. I tried without compressing the video with your package ✅ streaming !

So, maybe you use an encoding or format that leads the stream to fail ?

Thank you !

Platform

  • [X] Android
  • [X] iOS

React Native Version

0.72.5

React Native Compressor Version

1.8.16

serolgames avatar Nov 23 '23 10:11 serolgames

@serolgames now a days, i am very busy, hopefully i will check it after 6 to 7 days

numandev1 avatar Nov 23 '23 21:11 numandev1

Hello ! Hope your doing well

Any news about this problem ?

serolgames avatar Dec 28 '23 19:12 serolgames

same here, looks like only happened for android

a396901990 avatar Jan 18 '24 07:01 a396901990

Hello,,,,,same here ! Is there any fix to this issue ?

ghost avatar Jan 20 '24 10:01 ghost

Maybe I´m experimenting this same issue: https://github.com/numandev1/react-native-compressor/issues/268

noelsp avatar Jan 31 '24 21:01 noelsp

any update for this issue?

a396901990 avatar Feb 05 '24 06:02 a396901990

Can someone upload a demo of the issue? I have one video with this error, but I can't upload because is private from our customer.

noelsp avatar Feb 08 '24 18:02 noelsp

the issue for me is after the client uploads the compression video to the backend, the backend will use ffmpeg with the command line to generate base64 placeholder cmd := exec.Command("ffmpeg", "-i", "pipe:0", "-vframes", "1", "-q:v", "1", "-f", "singlejpeg", "pipe:1"). the error with pipe is [mov,mp4,m4a,3gp,3g2,mj2 @ 0x151f04950] stream 0, offset 0x2c: partial file [mov,mp4,m4a,3gp,3g2,mj2 @ 0x151f04950] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 640x360, 1676 kb/s): unspecified pixel format Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

somehow the file stream is broken when uploaded by Android with this library (ios is fine)

a396901990 avatar Feb 18 '24 05:02 a396901990

@numandev1 Hello, any update for this issue ?

serolgames avatar Feb 21 '24 12:02 serolgames

Have there been any updates here? I'm having trouble too

quoctruongkt avatar Apr 09 '24 10:04 quoctruongkt

For those who are suffering from this issue until now:

I found that this issue is because the result file actually not for faststart (moov flags should be placed before mdat, but this isn't). It can simply fixed by using ffmpeg to the result like this

ffmpeg -i result.mp4 -c copy -movflags faststart result_streamable.mp4

But this is not the happiest solution since it needs extra dependency(ffmpeg) which is quite heavy. But then, I figured out this library already have the logic for making result streamable, but it is disabled intentionally.

After enable the logic, fix some bug, I can finally get the file that may be streamable. Every probe tools said that the moov of the file is before mdat, and video is playable via player. But in browser, it is still unstreamable. I guess there is some other logical error in "convert" function in Streamable.kt

Since I'm not the media expert nor kotlin developer, I can't help but stop here. I hope this helps someone

korungg avatar May 22 '24 03:05 korungg

I am facing same issue. Is there any solution to resolve it

mittalkamal29 avatar May 23 '24 13:05 mittalkamal29

For those who are suffering from this issue until now:

I found that this issue is because the result file actually not for faststart (moov flags should be placed before mdat, but this isn't). It can simply fixed by using ffmpeg to the result like this

ffmpeg -i result.mp4 -c copy -movflags faststart result_streamable.mp4

But this is not the happiest solution since it needs extra dependency(ffmpeg) which is quite heavy. But then, I figured out this library already have the logic for making result streamable, but it is disabled intentionally.

After enable the logic, fix some bug, I can finally get the file that may be streamable. Every probe tools said that the moov of the file is before mdat, and video is playable via player. But in browser, it is still unstreamable. I guess there is some other logical error in "convert" function in Streamable.kt

Since I'm not the media expert nor kotlin developer, I can't help but stop here. I hope this helps someone

@numandev1 Look like it's a possible fix. Do you still work on the library ?

serolgames avatar Jun 03 '24 12:06 serolgames

The issue is still there. Any news ?

serolgames avatar Jul 03 '24 16:07 serolgames