[問題]使用sauronsoftware轉檔成mp4 但無法在HTML5上面播放的問題

看板java作者 (阿維)時間7年前 (2017/06/12 10:02), 編輯推噓1(107)
留言8則, 3人參與, 最新討論串1/1
小弟最近在撰寫一個轉檔程式 使用到sauronsoftware這個開放程式碼 我的目的是將影片轉檔成較小的mp4 並且可以在HTML5 上撥放 可是目前怎樣修一般撥放器可以但是HTML5就是不行 google似乎也沒有答案 請問有人有任何建議或是幫忙嗎 ----------------以下為我的程式碼----------------------- File source = new File("..\\input.mp4"); File target = new File("..\\target.mp4"); VideoAttributes video = new VideoAttributes(); video.setCodec("mpeg4"); video.setBitRate(new Integer(160000)); video.setFrameRate(new Integer(15)); video.setSize(new VideoSize(400, 300)); EncodingAttributes attrs = new EncodingAttributes(); attrs.setFormat("mp4"); attrs.setVideoAttributes(video); Encoder encoder = new Encoder(); try { encoder.encode(source, target, attrs); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InputFormatException e) { e.printStackTrace(); } catch (EncoderException e) { e.printStackTrace(); } -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.96.109.105 ※ 文章網址: https://www.ptt.cc/bbs/java/M.1497232976.A.D8C.html

06/12 14:17, , 1F
會不會 html tag 沒設好
06/12 14:17, 1F

06/12 14:18, , 3F
你有試過別人的mp4?
06/12 14:18, 3F

06/12 17:25, , 4F
我將影片拖曳到google chrome 就只有聲音播放...--
06/12 17:25, 4F

06/12 17:27, , 5F
應該說 原始的影片我都可以用HTML5撥放 可是轉換過
06/12 17:27, 5F

06/12 17:27, , 6F
後就不行 所以我想可能是Codec 但是我這邊實在不是
06/12 17:27, 6F

06/12 17:28, , 7F
熟悉 所以 希望有人可以解惑..
06/12 17:28, 7F

06/12 17:42, , 8F
沒有瀏覽器的HTML5吃mpeg4 (aka: Xvid, DivX) 的啦
06/12 17:42, 8F
文章代碼(AID): #1PFVPGsC (java)
文章代碼(AID): #1PFVPGsC (java)