作者godzilla1954 (阿維)
看板java
標題[問題]使用sauronsoftware轉檔成mp4 但無法在HTML5上面播放的問題
時間Mon Jun 12 10:02:54 2017
小弟最近在撰寫一個轉檔程式
使用到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
推 pttnews: 會不會 html tag 沒設好 06/12 14:17
→ pttnews: 你有試過別人的mp4? 06/12 14:18
→ godzilla1954: 我將影片拖曳到google chrome 就只有聲音播放...-- 06/12 17:25
→ godzilla1954: 應該說 原始的影片我都可以用HTML5撥放 可是轉換過 06/12 17:27
→ godzilla1954: 後就不行 所以我想可能是Codec 但是我這邊實在不是 06/12 17:27
→ godzilla1954: 熟悉 所以 希望有人可以解惑.. 06/12 17:28
→ Chikei: 沒有瀏覽器的HTML5吃mpeg4 (aka: Xvid, DivX) 的啦 06/12 17:42