作者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://webptt.com/cn.aspx?n=bbs/java/M.1497232976.A.D8C.html
1F:推 pttnews: 会不会 html tag 没设好 06/12 14:17
3F:→ pttnews: 你有试过别人的mp4? 06/12 14:18
4F:→ godzilla1954: 我将影片拖曳到google chrome 就只有声音播放...-- 06/12 17:25
5F:→ godzilla1954: 应该说 原始的影片我都可以用HTML5拨放 可是转换过 06/12 17:27
6F:→ godzilla1954: 後就不行 所以我想可能是Codec 但是我这边实在不是 06/12 17:27
7F:→ godzilla1954: 熟悉 所以 希望有人可以解惑.. 06/12 17:28
8F:→ Chikei: 没有浏览器的HTML5吃mpeg4 (aka: Xvid, DivX) 的啦 06/12 17:42