{"id":89,"date":"2010-11-05T06:27:00","date_gmt":"2010-11-05T06:27:00","guid":{"rendered":"https:\/\/pim.famnit.upr.si\/wp\/?p=89"},"modified":"2021-11-17T11:22:13","modified_gmt":"2021-11-17T11:22:13","slug":"merging-joining-two-videos-with-cat-and-quicktime-x","status":"publish","type":"post","link":"https:\/\/pim.famnit.upr.si\/wp\/?p=89","title":{"rendered":"Merging (joining) two videos with cat and QuickTime X"},"content":{"rendered":"<p><strong>QuickTime 7 had this great feature of merging two videos<\/strong> together just by dragging a video file from the Finder to another QuickTime video. Unfortunately <strong>this is not possible in QuicTime X<\/strong>. But I still wanted to do it without installing additional software and came up with a solution that includes a small hack :).<\/p>\n<p>Assume we have <strong>2 video files<\/strong> named <strong>video1.dv<\/strong> and <strong>video2.dv<\/strong> in <strong>~\/Movies<\/strong> folder that we want to merge.<\/p>\n<p><strong>1.&nbsp; Open the Terminal and navigate to Movies folder<\/strong><\/p>\n<pre style=\"font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;\">$ cd Movies<\/pre>\n<p><strong>2. Concatenate two files <\/strong><\/p>\n<pre style=\"font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;\">$ cat video1.dv video2.dv &gt; video3.dv<\/pre>\n<p>This step will take a while and the result is a strange (I don&#8217;t really want to say corrupted as it is just split in two MPEG containers) file, which will still play in most video players (I tried VLC and QuickTime X). This procedure works with transport stream formats (e.g. .dv, .ts, .mp3, .m2ts, etc.)<\/p>\n<p><strong>3. Open the new file in QuickTime X and re-save it&nbsp;<\/strong> <\/p>\n<p>File -&gt; Save As and select one of the available formats or use <\/p>\n<p>File -&gt; Save for web and choose the desired quality<\/p>\n<p>QuickTime X will re-save the file frame by frame with a proper (e.g. MOV or MP4) container.<\/p>\n<p>It is off course possible to use other software (e.g. ffmpeg) and procedures.<\/p>\n<p>PS: Comments on <a href=\"http:\/\/hints.macworld.com\/article.php?story=20101105030030245\">Mac OS X Hints<\/a> are worth reading<\/p>\n<\/p>\n<\/p>\n<p><strong>Edit 22\/4\/2011:<\/strong><br \/>I found out that it is possible to <a href=\"http:\/\/ubuntuforums.org\/showthread.php?t=509824\">merge videos<\/a> with cat and mencoder (mplayer) that rebuilds the index afterwards:<\/p>\n<p><strong>1. Install mencoder<\/strong><\/p>\n<pre style=\"font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;\">$ sudo port install mplayer<\/pre>\n<p> <strong>2. merge videos together<\/strong><\/p>\n<p>2.1 AVI<\/p>\n<pre style=\"font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;\">$ cat movie1.avi movie2.avi &gt; movie_new.avi\r\n$ mencoder -forceidx -oac copy -ovc copy movie_new.avi -o movie.avi\r\n<\/pre>\n<p>2.1 MPG<\/p>\n<pre style=\"font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;\">$ mencoder -oac copy -ovc copy movie1 movie2 -o movie.mpg\r\n<\/pre>\n<\/p>\n<p><strong><br \/>Edit 11\/9\/2012:<\/strong> <br \/>This tip is more a proof of concept than a serious\/professional way of joining videos. I still receive emails about this though. If you need something graphical <strong>with an UI, still light and opensource <\/strong>(and free as in free speech) try <strong><a href=\"\/blog\/index.php?\/archives\/264-Add-a-blur-to-a-part-of-a-video-with-Avidemux.html\">Avidemux<\/a><\/strong>. It can also concatenate or append (how they call it) files one after another. See the step 3.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>QuickTime 7 had this great feature of merging two videos together just by dragging a video file from the Finder to another QuickTime video. Unfortunately this is not possible in QuicTime X. But I still wanted to do it without installing additional software and came up with a solution that includes a small hack :).&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-89","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/posts\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=89"}],"version-history":[{"count":1,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions"}],"predecessor-version":[{"id":847,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions\/847"}],"wp:attachment":[{"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}