{"id":10750,"date":"2014-04-29T21:55:29","date_gmt":"2014-04-30T04:55:29","guid":{"rendered":"http:\/\/zachfine.com\/blog\/?p=10750"},"modified":"2014-04-29T22:02:27","modified_gmt":"2014-04-30T05:02:27","slug":"an-ffmpeg-recipe-to-concatenate-multiple-quicktime-files-and-convert-to-h264","status":"publish","type":"post","link":"https:\/\/zachfine.com\/blog\/2014\/04\/29\/an-ffmpeg-recipe-to-concatenate-multiple-quicktime-files-and-convert-to-h264\/","title":{"rendered":"An ffmpeg recipe to concatenate multiple quicktime files and convert to h264"},"content":{"rendered":"<p>If you ever find yourself with a set of same-as-source quicktime files that have been exported from Media Composer, one per reel of a film\u2026<\/p>\n<p>\n\u2013and you need to output a single h264 file of the film to upload to Dax or Pix or another of the various secure media platforms\u2026\n<\/p>\n<p>\n\u2013and you know your way around the Unix command line and have <a href=\"http:\/\/www.ffmpeg.org\/\">ffmpeg<\/a> installed on your machine\u2026\n<\/p>\n<p>\n\u2013then you&#8217;re in luck. Here&#8217;s how to use these tools do what you need.\n<\/p>\n<p>\nFirst, construct a text file that lists the files you mean to compress. My &#8220;mylist.txt&#8221; file contained the following lines:<\/p>\n<pre style=\"padding-left: 30px;\">file 'REEL 1V7 042914.mov'\r\nfile 'REEL 2V11 042914.mov'\r\nfile 'REEL 3V7 042914.mov'\r\nfile 'REEL 4V8 042914.mov'\r\nfile 'REEL 5V6 042914.mov'\r\nfile 'REEL 6V7 042914 fix.mov'<\/pre>\n<p>Put the mylist.txt file in the same directory as the source files, and also use the &#8216;cd&#8217; command to switch your shell session into that directory so that long paths won&#8217;t be needed. Then, run this ffmpeg command (I wrote it as one line, but broke it up here with the &#8216;\\&#8217; character at the end of each line so that it&#8217;d be readable):<\/p>\n<pre style=\"padding-left: 30px;\">time ffmpeg -f concat -i mylist.txt -framerate 23.976 -s hd720 -c:v libx264 \\\r\n-preset slower -profile:v baseline -g 24 -deblock 0:0 -c:a libfaac -b:a 96k \\\r\n-movflags rtphint+faststart -vb 2500k -pix_fmt yuv420p -f mp4 -threads 80 outputfilename.mp4<\/pre>\n<p>45 minutes after I did this, I had a single mp4 file containing all the reels in order, as h264. I checked all the transition points between reels and there were no glitches.\n<\/p>\n<p>\nThis saved me from having to stay at work an extra 4 hours that night, waiting for Media Composer to export a full-length same-as-source movie and then converting it to h264.\n<\/p>\n<p>\nI know what you&#8217;re thinking, &#8220;Why not just export to h264 from within Media Composer?&#8221;. Two reasons: Going to h264 directly from within Media Composer is slower than exporting same-as-source and feeding it into ffmpeg, and Media Composer&#8217;s h264 output doesn&#8217;t support as many options for hinting for streaming as were required for that upload.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you ever find yourself with a set of same-as-source quicktime files that have been exported from Media Composer, one per reel of a film\u2026 \u2013and you need to output a single h264 file of the film to upload to Dax or Pix or another of the various secure media platforms\u2026 \u2013and you know your [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[14,1404,28,13],"tags":[],"class_list":["post-10750","post","type-post","status-publish","format-standard","hentry","category-apple","category-asst-edit","category-filmmaking","category-geeky"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/ptNpF-2No","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/posts\/10750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/comments?post=10750"}],"version-history":[{"count":5,"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/posts\/10750\/revisions"}],"predecessor-version":[{"id":10755,"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/posts\/10750\/revisions\/10755"}],"wp:attachment":[{"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/media?parent=10750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/categories?post=10750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zachfine.com\/blog\/wp-json\/wp\/v2\/tags?post=10750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}