Downloading, Re-encoding, and Joining YouTube Videos

3

1

I've downloaded a set of Youtube Videos that are part of the same episode. Currently I've tried converting them into mp4 using ffmpeg and then joining with MP4Box.

for f in *.flv; do ffmpeg -i "$f" -vcodec copy -acodec copy "${f%.flv}.mp4"; done
MP4Box -cat part0.mp4 -cat part1.mp4 -cat part2.mp4 -cat part3.mp4 -cat part4.mp4 -new  video.mp4

However, upon joining with MP4Box opening the video in VLC does strange things. It seems create a video that has 3 different videos playing at the same time. Upon inspection, the videos have different bitrates and framerates, is this causing the problem?

Therefore, I'd like to re-encode the videos so that they are all the same and then joining them. Or is there a better way of accomplishing what I want?

Edit: I should have mentioned, I'd like to do this on the command line, as I want to semi-automate this process. Thanks!

Edit2: Seems like people are having similar problems as me with MP4Box. Sources:1 and 2. Then I tried avidemux, and it will merge them correctly but the audio is accelerated which is also cited here.

Final Edit and Solution: I followed the advice in this thread and converted the videos to mkv first, and then joined using mkvmerge, which worked great! Thanks!

James Smith

Posted 2011-07-10T19:22:07.920

Reputation: 51

It's worth posting that final edition and solution, as an answer and accepting it. – barlop – 2011-07-20T21:59:11.387

I didn't even realize you could answer your own question. Thanks and done! – James Smith – 2011-07-22T00:39:00.687

Answers

1

I followed the advice in this thread and converted the videos to mkv first, and then joined using mkvmerge, which worked great! Plus it's faster than the aforementioned software.

James Smith

Posted 2011-07-10T19:22:07.920

Reputation: 51

0

You can use the ffmpeg concat filter to concatenate multiple video files.

-filter_complex concat=n=%2:a=1

For example

ffmpeg -i vid1.flv -i vid2.flv -filter_complex concat=n=2:a=1 out.mp4

Note that the n parameter specifies the number of video files in this case.

Kissaki

Posted 2011-07-10T19:22:07.920

Reputation: 255

0

Did you give openshot a try? It's a free (as in speech) video editor for Linux.

OpenShot Video Editor is a free, open-source video editor for Linux licensed under the GPL version 3.0.

OpenShot can take your videos, photos, and music files and help you create the film you have always dreamed of. Easily add sub-titles, transitions, and effects, and then export your film to DVD, YouTube, Vimeo, Xbox 360, and many other common formats.

So if you're using ubuntu for example, it can join the videos for you easily.

lisa17

Posted 2011-07-10T19:22:07.920

Reputation: 1 019

When I tried using with my 1080p 60fps recordings it seemed very imprecise, clunky and it crashed. :( – Kissaki – 2016-08-29T23:27:45.993

I'm trying to script this up, is there a command line interface? Their documentation seems to be a little lacking. – James Smith – 2011-07-10T21:08:18.100

0

I'd recommend the bare-bones video editors of most operating systems. In Ubuntu, Pitivi (the most basic of functionality); in Windows, Windows movie maker; in OSX, iMovie. You can open a project, import and join whichever clips you want, and export it to your desired format.

Yitzchak

Posted 2011-07-10T19:22:07.920

Reputation: 4 084

he said command line in his edit – barlop – 2011-07-11T00:42:05.677

Which was made after I answered. – Yitzchak – 2011-07-11T14:40:58.817

Yes i'm not blaming you. But it still makes your answer somewhat irrelevant, but I suppose you may as well leave it unless you can add anything in an edit that is better. – barlop – 2011-07-11T16:40:02.087

You're right, it is somewhat irrelevant, but I might as well leave it -- don't have anything else to add, and it might help somebody else who doesn't need the command line. – Yitzchak – 2011-07-20T14:40:46.947

0

I would try Avidemux - it also has CMD interface, but I never used it. However, Avidemux always had good results as I needed it. :-)

Juhele

Posted 2011-07-10T19:22:07.920

Reputation: 2 297

0

The ffmpeg faq describes how to join video files. I don't know if this will solve the problem for you, but you may find it useful: How to join video files

matzahboy

Posted 2011-07-10T19:22:07.920

Reputation: 231