jonataslaw / VideoCompress

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

Compressing the video has the black space on left half. #195

Open vernalclareai opened 2 years ago

vernalclareai commented 2 years ago

Version 3.1.1 -Original Video:

https://user-images.githubusercontent.com/61595318/188926516-250c4cde-9eaa-4fdb-8b75-5ecbc641ac5b.MP4

-Video compressed using this library

image

olangpiostar commented 1 year ago

@vernalclareai I have the same issue. in my case, this error happens when compressing same video file(.mov extension) on IOS tablet, but not on android.

RudyTM commented 1 year ago

Have you find something? same issues :/ when uploading video from gallery on iOS, it has that space; when uploading from camera, it is ok

ahmdaeyz commented 9 months ago

So we had this in production, After some investigation using the OP's video, we found out that this happens due to the orientation of the video Here is the output of exiftool for the OP's video

Video Full Range Flag           : 0
Video Frame Rate                : 30
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 0000:00:00 00:00:00
Media Modify Date               : 0000:00:00 00:00:00
Media Time Scale                : 44100
Media Duration                  : 13.58 s
Media Language Code             : und
Handler Type                    : Audio Track
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 44100
Media Data Size                 : 2932362
Media Data Offset               : 5549
Image Size                      : 848x480
Megapixels                      : 0.407
Avg Bitrate                     : 1.73 Mbps
Rotation                        : 90

Now if you re-encoded the video the orientation will be zeroed and the issue won't happen :D

Media Time Scale                : 15360
Media Duration                  : 13.53 s
Media Language Code             : und
Handler Description             : VideoHandler
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 480
Source Image Height             : 848
X Resolution                    : 72
Y Resolution                    : 72
Compressor Name                 : Lavc59.37.100 libx264
Bit Depth                       : 24
Buffer Size                     : 0
Max Bitrate                     : 2020419
Average Bitrate                 : 2020419
Video Frame Rate                : 30
Handler Type                    : Metadata
Handler Vendor ID               : Apple
Encoder                         : Lavf59.27.100
Media Data Size                 : 3635242
Media Data Offset               : 16062
Image Size                      : 480x848
Megapixels                      : 0.407
Avg Bitrate                     : 2.14 Mbps
Rotation                        : 0
bselwe commented 9 months ago

@ahmdaeyz How did you resolve it exactly when using the video_compress package? Did you re-encode the video with another plugin before the compression?