Batch merge videos (some 200 videos) into single with blank screen (for 2-3 sec.) between each

0

There are similar questions on SU, but I have one ADDITIONAL requirement along with merging the videos.

I need to have a 2 seconds (or whatever seconds) of black screen between two consecutive videos. I'm looking for a free tool like ImageMagik (but for videos) which can easily merge the videos along with that black screen thing.

P.S. I have YouTube videos in Mp4 (tutorial series it is).

What is the fastest method I can use?

Kushal

Posted 2012-05-17T10:56:09.407

Reputation: 865

1"Merging" in the sense of appending them to one another? I'd probably recommend just creating an empty "black screen" video and then inserting that in between. – slhck – 2012-05-17T12:22:55.260

@slhck: that's good idea, but how to add a single file between every two different files? – Kushal – 2012-05-17T13:56:46.530

Well, you're gonna have a list of files, I guess. Just insert the blank video between those when feeding this list to your batch. See also: Command-line video editing in Linux (cut, join and preview)

– slhck – 2012-05-17T13:57:44.610

Answers

2

Very simple, if these are only MP4 ones. Install MP4Box (comes for every OS).

Then, you can concatenate MP4 videos by using:

mp4box -cat video1.mp4 -cat video2.mp4 -cat … output.mp4

And you're done. Just add as many -cat video.mp4 as you want.


Batch processing is simple too. Let's say you have a file with the blank two seconds, called blank.mp4, and a list of your input files videos.txt

#!/bin/bash
command="mp4box"
while IFS= read -r line
do
    command="$command"" -cat $line -cat blank.mp4"
done < "videos.txt"
command="$command output.mp4"
echo $command
eval $command

Save it somewhere, give it execute permissions with chmod +x batch.sh, and execute it with ./batch.sh. Obviously, blank.mp4 needs to be in the same folder. But you could easily modify that behaviour.

slhck

Posted 2012-05-17T10:56:09.407

Reputation: 182 472

but adding like 200 -cat video.mp4s is really needed? even if I have that blank_screen.mp4 in between every two videos? – Kushal – 2012-05-17T14:10:33.033

There was a slight problem with my script, but I updated it so it now executes everything in one line. You can test it if you want. – slhck – 2012-05-17T14:31:31.433

I tried installing MP4box in Ubuntu (12.04) using a .deb but having dependency issues, here's entire error: Dependency is not satisfiable: libavcodec52 (>= 4:0.5.1-1) | libavcodec-extra-52 (>= 4:0.5.1-1). After going through Synaptic, I saw both these packages are not available, instead, libavcodec-extra-53 is installed.

– Kushal – 2012-05-18T04:53:40.897

Hm, I've never used it on Ubuntu, so I'm not an expert on these dependency things. Have you enabled all package sources? – slhck – 2012-05-18T09:50:46.377

Okay, I guess I'll have to try using in Windows, as GPAC is known to work until 11.04, status is unknown beyond that. – Kushal – 2012-05-18T14:35:55.683

1

What kind of movies? Mpeg? AVI? FLV? Are you joining a bunch of Youtube Rips? It makes a difference.

For example, here is mpgtx, a simple command line tool that, among other things, joins mpeg video clips. It doesn't work with AVI or other movie file types. So, it would be useless for what you want to do. Thus,, I have no idea if suggesting it to you will work... since I don't know what kind of file type your movie clips are.

Maybe AviDemux is more of what you need. It doesn't operate from a command line, but it does handle a wider range of movie types and it can be automated using projects, a task queue and scripts. Which would mean joining a batch of movie clips, and telling it to add 2 seconds of nothing in between each would not be outside of it's range.

At any rate, Videohelp.com is your friend, as it is a website dedicated to providing it's visitors with everything video... and audio. Editing, that is.

Bon Gart

Posted 2012-05-17T10:56:09.407

Reputation: 12 574