{"id":1396,"date":"2008-04-21T23:04:21","date_gmt":"2008-04-22T04:04:21","guid":{"rendered":"http:\/\/granades.com\/?p=1396"},"modified":"2009-05-27T08:56:33","modified_gmt":"2009-05-27T13:56:33","slug":"sony-vegas-change-pixel-aspect-ratio","status":"publish","type":"post","link":"https:\/\/granades.com\/?p=1396","title":{"rendered":"Sony Vegas Script to Change the Pixel Aspect Ratio of Images"},"content":{"rendered":"<p>I spent far too long getting this to work <i>again<\/i> because I forgot to transfer the script from one computer to another, and all of the web references to this technique are, shall we say, broken like a character on <i>Battlestar Galactica<\/i>. So for anyone else who might need this, I give you a Sony Vegas script to change the pixel aspect ratio of all images in your media pool, written in C#.<\/p>\n<pre>\r\n<code>\r\n\/**\r\n * This script sets the Pixel Aspect Ratio of all images to be 0.9091.\r\n *\r\n * Author: Stephen Granade      Date: 21 April 2008\r\n **\/\r\n\r\nusing System.Text.RegularExpressions;\r\nusing Sony.Vegas;\r\n\r\npublic class EntryPoint {\r\n  public void FromVegas(Vegas vegas) {\r\n    foreach (Media media in vegas.Project.MediaPool) {\r\n      Match m = Regex.Match(media.FilePath, \"(jpe?g|png|gif)\");\r\n      if (m.Success) {\r\n        VideoStream vs = media.GetVideoStreamByIndex(0);\r\n        vs.PixelAspectRatio = 0.9091;\r\n      }\r\n    }\r\n  }\r\n}\r\n<\/code>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I spent far too long getting this to work again because I forgot to transfer the script from one computer to another, and all of the web references to this technique are, shall we say, broken like a character on Battlestar Galactica. So for anyone else who might need this, I give you a Sony &hellip; <a href=\"https:\/\/granades.com\/?p=1396\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Sony Vegas Script to Change the Pixel Aspect Ratio of Images<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-1396","post","type-post","status-publish","format-standard","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/granades.com\/index.php?rest_route=\/wp\/v2\/posts\/1396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/granades.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/granades.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/granades.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/granades.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1396"}],"version-history":[{"count":1,"href":"https:\/\/granades.com\/index.php?rest_route=\/wp\/v2\/posts\/1396\/revisions"}],"predecessor-version":[{"id":2936,"href":"https:\/\/granades.com\/index.php?rest_route=\/wp\/v2\/posts\/1396\/revisions\/2936"}],"wp:attachment":[{"href":"https:\/\/granades.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/granades.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/granades.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}