Concatenate diffetents video size in one output.mp4

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Concatenate diffetents video size in one output.mp4

Marcelo Laia
Hi,

I would like to concatenate two videos files.

1. 352 x 640
2. 640 x 352

All others parameters are the same.

I doing a lot of search on google and I tried:

ffmpeg -i VID-20170820-WA0233_edit_A_B.mp4 -i VID-20170820-WA0233_edit_B.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 -i VID-20170820-WA0233_edit_A_B.mp4 -i VID-20170820-WA0233_edit_B.mp4
-filter_complex
'[0:v]pad=iw:ih*2:0:0[intv];[intv][1:v]overlay=(W-w)/2:H/2[vid]' -map [vid]
-c:v libx264 -crf 22 -preset veryfast output.mp4

MP4Box -cat video_640.mp4 -cat VID-20170820-WA0233_edit_B.mp4 -new output.mp4

But, I don't got a joined videos.

Please, is it a way to join (concatenate) these two videos? The history: My
daughter started a recording with her cellphone in a vertical and after 30
seconds she rotate de cell to horizontally. So, the video start in vertical end
rotate to horizontal. I split it with avidemux and got they in horizontal way
(I rotate on with avidemux). Both, ffmpeg and avidemux not doing the job
(concatenate).

Thank you

--
Marcelo
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate diffetents video size in one output.mp4

Paul B Mahol
On 9/8/17, Marcelo Laia <[hidden email]> wrote:

> Hi,
>
> I would like to concatenate two videos files.
>
> 1. 352 x 640
> 2. 640 x 352
>
> All others parameters are the same.
>
> I doing a lot of search on google and I tried:
>
> ffmpeg -i VID-20170820-WA0233_edit_A_B.mp4 -i VID-20170820-WA0233_edit_B.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

This one should work from quick look.

>
> ffmpeg -i VID-20170820-WA0233_edit_A_B.mp4 -i VID-20170820-WA0233_edit_B.mp4
> -filter_complex
> '[0:v]pad=iw:ih*2:0:0[intv];[intv][1:v]overlay=(W-w)/2:H/2[vid]' -map [vid]
> -c:v libx264 -crf 22 -preset veryfast output.mp4

This is not concatination.

>
> MP4Box -cat video_640.mp4 -cat VID-20170820-WA0233_edit_B.mp4 -new
> output.mp4
>
> But, I don't got a joined videos.

What you get instead?

>
> Please, is it a way to join (concatenate) these two videos? The history: My
> daughter started a recording with her cellphone in a vertical and after 30
> seconds she rotate de cell to horizontally. So, the video start in vertical
> end
> rotate to horizontal. I split it with avidemux and got they in horizontal
> way
> (I rotate on with avidemux). Both, ffmpeg and avidemux not doing the job
> (concatenate).
>
> Thank you
>
> --
> Marcelo
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate diffetents video size in one output.mp4

Marcelo Laia
On 08/09/17 at 08:49, Paul B Mahol wrote:
> On 9/8/17, Marcelo Laia <[hidden email]> wrote:
>
> This one should work from quick look.

marcelo@marcelo:~/Vídeos/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)
[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@marcelo:~/Vídeos/Ceverja$

No output.mp4 is rendered.

>
> What you get instead?
>
marcelo@marcelo:~/Vídeos/Ceverja$ MP4Box -cat Parte_A1.mp4 -cat Parte_B1.mp4
-new output.mp4
Appending file Parte_A1.mp4
No suitable destination track found - creating new one (type vide)
No suitable destination track found - creating new one (type soun)
Appending file Parte_B1.mp4                      
Saving output.mp4: 0.500 secs Interleaving      
marcelo@marcelo:~/Vídeos/Ceverja$

The output.mp4 is created, but the Parte_A1.mp4 is a statitc image. Only
Parte_B1.mp4 is a video (stream).


--
Marcelo
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate diffetents video size in one output.mp4

Paul B Mahol
On 9/8/17, Marcelo Laia <[hidden email]> wrote:

> On 08/09/17 at 08:49, Paul B Mahol wrote:
>> On 9/8/17, Marcelo Laia <[hidden email]> wrote:
>>
>> This one should work from quick look.
>
> marcelo@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@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
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate diffetents video size in one output.mp4

Marcelo Laia
On 09/09/17 at 09:29, Paul B Mahol wrote:

> On 9/8/17, Marcelo Laia <[hidden email]> wrote:
> > On 08/09/17 at 08:49, Paul B Mahol wrote:
> >> On 9/8/17, Marcelo Laia <[hidden email]> wrote:
>
> 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

I got this error message:

[AVFilterGraph @ 0x561b93f482a0] No output pad can be associated to link label
'1:v'.
Error initializing complex filters.
Invalid argument


I tried another approach and it worked:

ffmpeg -i Parte_A1.mp4 -i Parte_B1.mp4 -filter_complex "[0:v]scale=640:352,
setsar=1/1, setpts=PTS-STARTPTS[v0]; [1:v]scale=640:352, setsar=1/1,
setpts=PTS-STARTPTS[v1];  [v0][0:a] [v1][1:a] concat=n=2:v=1:a=1[v][a]" -map
"[v]" -vcodec libx264 -b:v 512k -pix_fmt yuv420p -map "[a]" -acodec aac -b:a
128k -ar 44100 -movflags faststart -y "result.mp4"

But, I would like to take the first approach to work too to see what is the
difference between both.

Thank you so much!

--
Marcelo
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".