PHP-FFMpeg/PHP-FFMpeg

Width not divisible by 2 when padding an h264 video

Open

#643 创建于 2019年4月17日

在 GitHub 查看
 (1 评论) (1 反应) (0 负责人)PHP (4,641 star) (915 fork)batch import
bughelp wanted

描述

Q A
Bug? yes
New Feature? no
Version Used 0.13
FFmpeg Version ffmpeg version 3.1.3-1~bpo8+1 Copyright (c) 2000-2016 the FFmpeg developers
OS Linux

Actual Behavior

The problem happens when I try to encode into h264 and specify output width not divisible by 2 and use pad filter.

Expected Behavior

I should be able to have an output file exactly the same width as I want - 315px, not more or less.

Steps to Reproduce

$ffmpeg = FFMpeg\FFMpeg::create(FFMPEG_CONFIG_VARS);
$video = $ffmpeg->open($video_file);
$format = new FFMpeg\Format\Video\X264();

$video
    ->filters()
    ->pad(new FFMpeg\Coordinate\Dimension(315, 300)) 

$video->save($format, $final_video_file);

will produce this error [libx264 @ 0x797260] width not divisible by 2(315x170)

Possible Solutions

Some people suggest to add or remove one pixel so in my case instead of width 315px I should specify 316 or 314, but that is not accurate enough for me.

贡献者指南