Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distorted video (iphone) #564

Open
1271 opened this issue Aug 21, 2018 · 8 comments
Open

Distorted video (iphone) #564

1271 opened this issue Aug 21, 2018 · 8 comments

Comments

@1271
Copy link

1271 commented Aug 21, 2018

Q A
Bug? no
New Feature? no
Version Used v0.11.1-pl-1
FFmpeg Version 2.8.14-0ubuntu0.16.04.1
OS Ubuntu Linux 4.16.3

Actual Behavior

php-ffmpeg distorts video (iphone)

Expected Behavior

Hello. There is a problem with the horizontal video received from the iphone.
This is a problem for me. I now need to check every video before converting.

ffmpeg -i input.mov -vf 'scale = 320: 320: force_original_aspect_ratio = decrease' output.mp4

This works fine and I expected this behavior for php-ffmpeg, but this does not happen.

Instead, php-ffmpeg thinks this is in the AspectRatio class, instead of doing system ffmpeg.

\ Sorry for my English

@jens1o
Copy link
Member

jens1o commented Aug 21, 2018

Could you send us the code you are using?

@1271
Copy link
Author

1271 commented Aug 23, 2018

Video source:
FF2KWhaOXoyp.mov.zip

require 'vendor/autoload.php';

$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open('video.mov');
$video->filters()
    ->resize(
        new FFMpeg\Coordinate\Dimension(600, 600),
        FFMpeg\Filters\Video\ResizeFilter::RESIZEMODE_INSET
    )
    ->synchronize();

$video
    ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
    ->save('frame.jpg'); // bad orientation
$video
    ->save(new FFMpeg\Format\Video\X264(), 'export-x264.mp4'); // bad orientation

@jens1o
Copy link
Member

jens1o commented Aug 23, 2018

What is happening if you replace RESIZEMODE_INSET with RESIZEMODE_SCALE_WIDTH?

@1271
Copy link
Author

1271 commented Aug 23, 2018

It does not change anything. The problem is not in the size of the video, but in the fact that it has the wrong orientation.

@jens1o
Copy link
Member

jens1o commented Aug 23, 2018

But when you try to resize it to 600 x 600, it should be a square and RESIZEMODE_SCALE_WIDTH tries to further optimize it?

@1271
Copy link
Author

1271 commented Aug 23, 2018

The problem is not that the video will be square.
The problem is that it is rotated 90 degrees

In this case, if this video is converted using ffmpeg from the terminal, everything is fine.

@1271
Copy link
Author

1271 commented Aug 23, 2018

try playing the video using mplayer and ffplay

@arall
Copy link

arall commented May 31, 2020

I'm experiencing the same issue with vertical iPhone videos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants