[FFmpeg-user] Concat limited to certain file types?

Jan Ehrhardt phpdev at ehrhardt.nl
Wed Oct 17 00:54:21 CEST 2012


Roger Pack in gmane.comp.video.ffmpeg.user (Tue, 16 Oct 2012 15:36:09
-0600):
>>>What is a command line that failed?
>>
>> For instance:
>>
>> ffmpeg -i S1000001.MP4 -i S1000002.MP4 -filter_complex "[0:0] [0:1]
>>         [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a],scale=384:288"
>>         -map [v] -map [a] -aspect 4:3 -vcodec libx264 -b:v 320k
>>         -strict -2 -acodec aac -ab 96k -y out.mp4
>> Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_scale_1
>
>My guess is you need to provide an input to scale, like "[v] scale" ?

[v:0] scale added an extra track to the output with the scaled video of
the first input file. After a lot of trial and error I found that this
command line produced a reasonable result:

ffmpeg.exe -i S1000001.MP4 -i S1000002.MP4 \
	-filter_complex "[0:1] [1:1] concat=n=2:v=0:a=1 [a], \
	[0:0] scale=384:288 [v1],[1:0] scale=384:288 [v2], \
	[v1] [v2] concat=n=2:v=1:a=0 [v]" -map [v] -map [a] \
	-aspect 4:3 -vcodec libx264 -b:v 320k \ 
	-strict -2 -acodec aac -ab 96k -y out.mp4 

However, you concat the video tracks and audio tracks separately and
probably lose the synchronisation. MP4Box -info shows that the audio
track of this output is shorter than the one with -s 384x288. Tiny but
significant difference between 00:00:14.992 and 00:00:14.976:

S:\>\utils\mp4box -info \sd_video\prg001\mp4complex_concat_scaled.mp4
* Movie Info *
        Timescale 1000 - Duration 00:00:15.080
        2 track(s)
        Fragmented File: no
        File suitable for progressive download (moov before mdat)
        File Brand isom - version 512
        Created: UNKNOWN DATE
File has no MPEG4 IOD/OD

iTunes Info:
        Encoder Software: Lavf54.29.104

Track # 1 Info - TrackID 1 - TimeScale 25 - Duration 00:00:15.080
Media Info: Language "Undetermined" - Type "vide:avc1" - 377 samples
Visual Track layout: x=0 y=0 width=384 height=288
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 384 x 288
        AVC Info: 1 SPS - 1 PPS - Profile Baseline @ Level 3
        NAL Unit length bits: 32
        Pixel Aspect Ratio 1:1 - Indicated track size 384 x 288
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:00:14.992
Media Info: Language "Undetermined" - Type "soun:mp4a" - 701 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1
Alternate Group ID 1


S:\>\utils\mp4box -info out.mp4
* Movie Info *
        Timescale 1000 - Duration 00:00:15.080
        2 track(s)
        Fragmented File: no
        File suitable for progressive download (moov before mdat)
        File Brand isom - version 512
        Created: UNKNOWN DATE
File has no MPEG4 IOD/OD

iTunes Info:
        Encoder Software: Lavf54.29.104

Track # 1 Info - TrackID 1 - TimeScale 25 - Duration 00:00:15.080
Media Info: Language "Undetermined" - Type "vide:avc1" - 377 samples
Visual Track layout: x=0 y=0 width=384 height=288
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 384 x 288
        AVC Info: 1 SPS - 1 PPS - Profile Baseline @ Level 3
        NAL Unit length bits: 32
        Pixel Aspect Ratio 1:1 - Indicated track size 384 x 288
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:00:14.976
Media Info: Language "Undetermined" - Type "soun:mp4a" - 701 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1
Alternate Group ID 1

Jan



More information about the ffmpeg-user mailing list