{"id":802,"date":"2018-07-18T14:45:06","date_gmt":"2018-07-18T18:45:06","guid":{"rendered":"http:\/\/main.jmah.net\/?p=802"},"modified":"2021-05-11T14:56:46","modified_gmt":"2021-05-11T18:56:46","slug":"extracting-a-portion-of-video-using-ffmpeg","status":"publish","type":"post","link":"https:\/\/main.jmah.net\/?p=802","title":{"rendered":"Extracting a Portion of Video using FFMPEG"},"content":{"rendered":"<p><a href=\"http:\/\/main.jmah.net\/?attachment_id=714\" rel=\"attachment wp-att-714\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-714\" src=\"http:\/\/main.jmah.net\/wp-content\/uploads\/2017\/01\/ffmpeg-e1484897077295.jpg\" alt=\"\" width=\"300\" height=\"168\" \/><\/a>If you would like to extract a portion of a video without re-encoding, consider using FFMPEG. The following example illustrates a command to extract a video from the 24th minute line and for 4 minutes 8 seconds, keeping all audio tracks.<\/p>\n<p><strong>ffmpeg -i input.mp4 -c copy -ss 00:24:00.000 -t 00:04:08.000 -map 0:v -map 0:a output.mp4<\/strong><\/p>\n<p>The example above may result in blank video in the beginning. If it is more important to have the video than audio, the following can be used (which may cause blank audio in the beginning).<\/p>\n<p><strong>ffmpeg -ss 00:24:00.000 -i input.mp4 -c copy -t 00:04:08.000 -map 0:v -map 0:a output.mp4<\/strong><\/p>\n<p>The most accurate way to extract part of a video is to re-encode (without -c copy), which may result in loss of quality and takes longer to process. <a href=\"https:\/\/ottverse.com\/trim-cut-video-using-start-endtime-reencoding-ffmpeg\/\" target=\"_blank\" rel=\"noopener\">This article<\/a> describes the topic in details.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you would like to extract a portion of a video without re-encoding, consider using FFMPEG. The following example illustrates a command to extract a video from the 24th minute line and for 4 minutes 8 seconds, keeping all audio &hellip; <a href=\"https:\/\/main.jmah.net\/?p=802\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,7],"tags":[],"class_list":["post-802","post","type-post","status-publish","format-standard","hentry","category-ffmpeg","category-research-information-technology"],"_links":{"self":[{"href":"https:\/\/main.jmah.net\/index.php?rest_route=\/wp\/v2\/posts\/802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/main.jmah.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/main.jmah.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/main.jmah.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/main.jmah.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=802"}],"version-history":[{"count":5,"href":"https:\/\/main.jmah.net\/index.php?rest_route=\/wp\/v2\/posts\/802\/revisions"}],"predecessor-version":[{"id":967,"href":"https:\/\/main.jmah.net\/index.php?rest_route=\/wp\/v2\/posts\/802\/revisions\/967"}],"wp:attachment":[{"href":"https:\/\/main.jmah.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/main.jmah.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/main.jmah.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}