{"id":2594,"date":"2024-12-07T19:04:24","date_gmt":"2024-12-07T08:04:24","guid":{"rendered":"http:\/\/www.menogue.com\/evan\/blog\/?p=2594"},"modified":"2024-12-07T19:04:24","modified_gmt":"2024-12-07T08:04:24","slug":"extracting-videos-from-android-motion-photos","status":"publish","type":"post","link":"https:\/\/menogue.com\/evan\/blog\/index.php\/2024\/12\/07\/extracting-videos-from-android-motion-photos\/","title":{"rendered":"Extracting videos from Android Motion Photos"},"content":{"rendered":"<p>A MP4 video file follows the JPEG image file in a Android Phone &#8216;Motion photo&#8217; with a filename starting MVIMG<\/p>\n<p>EXIFTool can extract the video files with a single command, from Phil Harvey EXIFTool Developer:<\/p>\n<div>\n<div>\n<blockquote>\n<div id=\"msg_77523\" data-msgid=\"77523\">Here is a command that will extract the video from all jpg images in a directory and store the videos with the same file name as the jpg but with extension .mp4:<\/p>\n<p><strong>exiftool -b -p &#8220;${trailer;s\/.*(\\0\\0\\0\\x1cftypisom)\/$1\/s}&#8221; -ext jpg -w mp4 DIR<\/strong><\/p>\n<p>&#8211; Phil<\/p><\/div>\n<\/blockquote>\n<\/div>\n<blockquote>\n<div>\u00a0&#8230;where\u00a0DIR\u00a0is the name of a directory\/folder containing the images.\u00a0 On Mac\/Linux\/PowerShell, use single quotes (&#8216;) instead of double quotes (&#8220;) around arguments containing a dollar sign ($).<\/div>\n<div><\/div>\n<div>Wow, thanks, that works. I would never have been able to figure that out myself. Would you be so kind as to explain the &#8220;-p&#8221; parameter to me, please?<\/p>\n<p>-b<br \/>\nOutput metadata in binary format. That&#8217;s what I&#8217;ve tried.<\/p>\n<p>-p &#8220;${trailer;s\/.*(\\0\\0\\0\\x1cftypisom)\/$1\/s}&#8221;<br \/>\nWhat the hell are you doing here? I found this link but it doesn&#8217;t help me:<br \/>\nhttps:\/\/exiftool.org\/exiftool_pod.html#Advanced-formatting-feature<\/p>\n<p>-ext jpg<br \/>\nProcess files with the specified extension<\/p>\n<p>-w mp4<br \/>\nNew filename extension<\/p>\n<p>DIR<br \/>\nDirectory or filename<\/p><\/div>\n<div><\/div>\n<div>This uses the advanced formatting feature as you surmised to remove everything before the MP4 header.\u00a0 The &#8220;\\0\\0\\0\\x1cftypisom&#8221; string is the binary MP4 header.\u00a0 &#8220;.*&#8221; is everything before that.\u00a0 The s\/\/\/ is the Perl substitution operator (ie. search and replace), and it replaces everything up to and including the header with just the header (&#8220;$1&#8221; is everything inside the brackets in the search pattern of the substitution operator).\u00a0 Read about &#8220;regular expressions&#8221; if you want to know more about the syntax.<\/p>\n<p>&#8211; Phil<\/p><\/div>\n<\/blockquote>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A MP4 video file follows the JPEG image file in a Android Phone &#8216;Motion photo&#8217; with a filename starting MVIMG EXIFTool can extract the video files with a single command, from Phil Harvey EXIFTool Developer: Here is a command that will extract the video from all jpg images in a directory and store the videos [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2594","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/menogue.com\/evan\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/menogue.com\/evan\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/menogue.com\/evan\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/menogue.com\/evan\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/menogue.com\/evan\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=2594"}],"version-history":[{"count":0,"href":"https:\/\/menogue.com\/evan\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2594\/revisions"}],"wp:attachment":[{"href":"https:\/\/menogue.com\/evan\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=2594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/menogue.com\/evan\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=2594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/menogue.com\/evan\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=2594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}