PHP-FFMpeg/PHP-FFMpeg

Width not divisible by 2 when padding an h264 video

オープン

#643 opened on 2019/04/17

 (1 件のコメント) (1 件のリアクション) (0 人の担当者)PHP (915 件のフォーク)batch import
bughelp wanted

Repository metrics

Stars
 (4,641 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

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.

コントリビューターガイド