[FFmpeg-user] Concatenate diffetents video size in one output.mp4
Paul B Mahol
onemda at gmail.com
Sat Sep 9 10:29:16 EEST 2017
On 9/8/17, Marcelo Laia <marcelolaia at gmail.com> wrote:
> On 08/09/17 at 08:49, Paul B Mahol wrote:
>> On 9/8/17, Marcelo Laia <marcelolaia at gmail.com> wrote:
>>
>> This one should work from quick look.
>
> marcelo at marcelo:~/Videos/Ceverja$ ffmpeg -i Parte_A1.mp4 -i Parte_B1.mp4
> -filter_complex
> "[0:v]scale=640:352:force_original_aspect_ratio=decrease,pad=640:352:(ow-iw)/2:(oh-ih)/2[v0];
> [v0][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v
> libx264
> -c:a aac -movflags +faststart output.mp4
> ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
> built with gcc 7 (Debian 7.1.0-13)
> (split)
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Parte_A1.mp4':
> Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf57.71.100
> Duration: 00:00:10.03, start: 0.165985, bitrate: 9538 kb/s
> Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 /
> 0x31637661),
> yuv420p, 352x640 [SAR 1:1 DAR 11:20], 9412 kb/s, 23.95 fps, 23.95 tbr, 23954
> tbn, 47.91 tbc (default)
> Metadata:
> handler_name : VideoHandler
> Stream #0:1(unk): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
> fltp, 128 kb/s (default)
> Metadata:
> handler_name : SoundHandler
> Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'Parte_B1.mp4':
> Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf57.71.100
> Duration: 00:00:24.01, start: 0.165985, bitrate: 8940 kb/s
> Stream #1:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 /
> 0x31637661),
> yuv420p, 640x352 [SAR 1:1 DAR 20:11], 8808 kb/s, 23.95 fps, 23.95 tbr, 23954
> tbn, 47.91 tbc (default)
> Metadata:
> handler_name : VideoHandler
> Stream #1:1(unk): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
> fltp, 127 kb/s (default)
> Metadata:
> handler_name : SoundHandler
> File 'output.mp4' already exists. Overwrite ? [y/N] y
> Stream mapping:
> Stream #0:0 (h264) -> scale
> Stream #0:1 (aac) -> concat:in0:a0
> Stream #1:0 (h264) -> concat:in1:v0
> Stream #1:1 (aac) -> concat:in1:a0
> concat:out:v0 -> Stream #0:0 (libx264)
> concat:out:a0 -> Stream #0:1 (aac)
> Press [q] to stop, [?] for help
> [Parsed_concat_2 @ 0x55e37b087000] Input link in1:v0 parameters (size
> 640x352,
> SAR 1:1) do not match the corresponding output link in0:v0 parameters
> (640x352,
> SAR 484:485)
Read this text next time and think about it more.
You need setsar=1/1 for 2nd input.
> [Parsed_concat_2 @ 0x55e37b087000] Failed to configure output pad on
> Parsed_concat_2
> Error reinitializing filters!
> Failed to inject frame into filter network: Invalid argument
> Error while processing the decoded data for stream #1:0
> Conversion failed!
> marcelo at marcelo:~/Videos/Ceverja$
>
Try this:
$ ffmpeg -i Parte_A1.mp4 -i Parte_B1.mp4 -filter_complex
"[0:v]scale=640:352:force_original_aspect_ratio=decrease,pad=640:352:(ow-iw)/2:(oh-ih)/2[v0];
[1:v]setsar=1/1[v1];[v0][0:a][v1][1:a]concat=n=2:v=1:a=1[v][a]" -map
"[v]" -map "[a]" -c:v libx264 -c:a aac -movflags +faststart output.mp4
More information about the ffmpeg-user
mailing list