[FFmpeg-user] Joining mp4 files did not yield the expected file

jd1008 jd1008 at gmail.com
Tue Dec 29 22:31:38 CET 2015



On 12/29/2015 12:49 PM, Lou wrote:
> On Tue, 29 Dec 2015 12:44:48 -0700
> jd1008 <jd1008 at gmail.com> wrote:
>
>> Command:
>>
>> ffmpeg \
>> -i Discourse_1_Part_1.mp4 \
>> -i Discourse_1_Part_2.mp4 \
>> -i Discourse_2_Part_1.mp4 \
>> -i Discourse_2_Part_2.mp4 \
>> -i Discourse_3_Part_1.mp4 \
>> -i Discourse_3_Part_2.mp4 \
>> -strict -2 -y All_Discourses.mp4
> Complete console output is missing. This is required.
>
>> Yielded a result much smaller than expected (in size) and
>> when played, does not contain the contents of all the parts.
> What are you trying to do exactly?
>
> Default stream selection behavior is to select one stream of each type:
> http://ffmpeg.org/ffmpeg.html#Stream-selection
> _______________________________________________
Using the info on the Concatenate Wiki page listed by Reindle,
I concocted this script and it worked perfectly; albeit, I would
have liked the output to be in HD (1920x1080).
However, every time I tried to set the size to 1920x1080, it
took forever to transcode a small video file, so I abandoned
the HD for the output.
This is the script I used:

#!/bin/ksh

infile[1]=Discourse_1_Part_1.mp4
infile[2]=Discourse_1_Part_2.mp4
infile[3]=Discourse_2_Part_1.mp4
infile[4]=Discourse_2_Part_2.mp4
infile[5]=Discourse_3_Part_1.mp4
infile[6]=Discourse_3_Part_2.mp4
O1=All_Discourses.mp4

list="concat:"

for i in 1 2 3 4 5 6; do
         echo "ffmpeg -i ${infile[i]} -c copy -bsf:v h264_mp4toannexb -f 
mpegts -y intermediate$i.ts"
         # ffmpeg -i ${infile[i]} -c copy -bsf:v h264_mp4toannexb -f 
mpegts -y intermediate$i.ts
         case $i in
         1) list="$list"intermediate$i.ts ;;
         *) list="$list""|intermediate$i.ts" ;;
         esac
done
echo list = "$list"

echo ffmpeg -i '"$list"' -c copy -bsf:a aac_adtstoasc -y $O1

ffmpeg -i '"$list\"' -c copy -bsf:a aac_adtstoasc -y $O1

For some reason, ffmpeg command line insists that the list of .ts files be
in double quotes. So, I enclosed the list first in double quotes on inside,
and then in single quotes around them.
Perhaps this is a ksh caveat???




More information about the ffmpeg-user mailing list