[FFmpeg-user] Concatenate x10?

Tamas Szanka tamas.szanka at gmail.com
Thu Jun 29 12:48:50 EEST 2023


Using this code via Python, but it does not work. The output is 1kb mp4
file that contains nothing.

>>>>>
import os
import subprocess

# Path to the directory containing the video files
video_directory = "C:/User/Desktop/2"

# Path to the endscreen video
endscreen_video = "C:/User/Desktop/endscreen.mp4"

# Output directory for the concatenated videos
output_directory = "C:/User/Desktop/2"

# List of video files
video_files = [
    "video1.MP4",
    "video2.MP4",
    "video3.MP4",
    "video4.MP4"
    "video5.MP4"
    "video6.MP4"
    "video7.MP4"
    "video8.MP4"
    "video9.MP4"
    "video10.MP4"
]

# Loop through the video files
for video_file in video_files:
    input_video = os.path.join(video_directory, video_file)
    output_video = os.path.join(output_directory, video_file)

    # Concatenate the video and endscreen using FFmpeg
    cmd = f'ffmpeg -i "{input_video}" -i "{endscreen_video}"
-filter_complex "[0:v][1:v]concat=n=2:v=1:a=0" -c:v libx264 -crf 18 -preset
veryfast -c:a copy "{output_video}"'
    subprocess.call(cmd, shell=True)
>>>>>>>
Any suggestions?


On Thu, Jun 29, 2023 at 10:06 AM DEF <shaker.doc at gmail.com> wrote:

> On Thu, 29 Jun 2023 at 05:09, Tamas Szanka <tamas.szanka at gmail.com> wrote:
> >
> > There are 10.mp4 files (video1-10), each needs the same endscreen,
> > "credit.mp4"
> >
> > Currently I'm combining video+credit one by one Is there a better way to
> do
> > this with a command line or with a .txt file?
>
> Yes.
> embed the "video+credit" of one into a FOR LOOP!
>
> DEF
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list