{"id":1021,"date":"2013-09-13T14:39:56","date_gmt":"2013-09-13T13:39:56","guid":{"rendered":"http:\/\/paulo72.com\/?p=1021"},"modified":"2017-05-17T23:21:52","modified_gmt":"2017-05-17T22:21:52","slug":"encoding-video-for-the-web","status":"publish","type":"post","link":"https:\/\/actino.local\/other\/encoding-video-for-the-web\/","title":{"rendered":"Encoding Video For The Web"},"content":{"rendered":"
To try and encode video that plays in all of the following:<\/p>\n
Sounds easy? Just encode an MP4 in HandBrake<\/a>, and JWPlayer<\/a> will do the rest? Nearly.<\/p>\n JWPlayer will work just fine however the various different devices can be pretty picky about the exact encoding format. Android and IE9 in particular get all distressed and soil themselves if it isn’t just-so.<\/p>\n After hours of Googling and experimentation with encoding formats and details these are the Handbrake settings that worked for me.<\/p>\n The significant option selections are highlighted with red circles.<\/p>\n\n The key here is to choose MP4, encoded in x264.<\/p>\n The \u2018Level: 3\u2019 and \u2018Profile: Baseline\u2019 bit is for support on older Android devices. Checking \u2018Web Optimised\u2019 moves the MOOV Atom to the front of the video, which means that it streams properly (otherwise your browser\u00a0has to download the entire video before it can start to play).<\/p>\n I don’t think I changed any audio settings. These see to be the default settings for x264 and they work just fine.<\/p>\n<\/a>If you started off by using a preset you might find that Handbrake has re-sized your videos to a more standard aspect ratio. Click \u2018Picture settings\u2019 at the top of the main interface to see the size at which your video will be output.<\/p>\n If they are not as you wish\u00a0then change them here. Uncheck the \u2018Keep Aspect Ratio\u2019 option\u00a0if it will not allow you to select your preferred dimensions, and \u00a0switch \u2018Anamorphic\u2019 to none (unless you want the black letterboxing effect). Also check the \u2018Cropping\u2019 is set to zero.<\/p>\n <\/a>\n If you are using html5 <video> tags you won’t need the below. We needed to provide a Flash fallback as our browser support went back to pre-html5 browsers.<\/p>\n How to encode mp4 video files that work with HTML5 and Flash in Android, iOS, IE9 and the rest.<\/p>\n","protected":false},"author":1,"featured_media":1128,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[45],"yst_prominent_words":[105,188,90,88,85,94,97,82,101],"_links":{"self":[{"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/posts\/1021"}],"collection":[{"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/comments?post=1021"}],"version-history":[{"count":7,"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/posts\/1021\/revisions"}],"predecessor-version":[{"id":1352,"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/posts\/1021\/revisions\/1352"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/media\/1128"}],"wp:attachment":[{"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/media?parent=1021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/categories?post=1021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/tags?post=1021"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/actino.local\/wp-json\/wp\/v2\/yst_prominent_words?post=1021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}#<\/i><\/a>The Solution<\/h2>\n
#<\/i><\/a>The Code<\/h2>\n
<div\u00a0id=\"myVideo\"><\/div>\r\n<script\u00a0type=\"text\/javascript\"\u00a0src=\"jwplayer.js\"><\/script>\r\n<script\u00a0type=\"text\/javascript\">\r\n\u00a0\u00a0jwplayer.key=\"thisisthejwplayerauthorisationkey==\"\r\n\u00a0\u00a0jwplayer(\"myVideo\").setup({\r\n\u00a0\u00a0\u00a0\u00a0file:\u00a0\u00a0\u00a0\u00a0\u00a0\"vip9.mp4\"\r\n\u00a0\u00a0\u00a0\u00a0width:\u00a0\u00a0\u00a0\u00a0720\r\n\u00a0\u00a0\u00a0\u00a0height:\u00a0\u00a0\u00a0400\r\n\u00a0\u00a0\u00a0\u00a0primary:\u00a0\u00a0\"flash\"\r\n\u00a0\u00a0\u00a0\u00a0analytics:\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0enabled:\u00a0false\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0cookies:\u00a0\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0});\r\n<\/script><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"