好一陣子沒發文了…..
來貼個文吧……
用Div偽裝Select變身成ComboBox
有需要拿去用吧
需求:想要把 flv 檔,抓出指定的秒數並存成圖片。
問了一些同事,如果要用 java 達到這個目的的話,有沒有什麼套件可以用?
最後找到了ffmpeg,透過java去呼叫ffmpeg 可以做到
需要先下載ffmpeg→我在 這裡 下載ffmpeg-r13712-gpl-shared-win32.tar.bz2這個,解壓縮後,可使用。
單純用ffmpeg的指令如下:
ffmpeg -y -i coke.flv -vframes 1 -ss 00:00:03 -an -vcodec mjpeg -f rawvideo -s 320×240 test.jpg
使用java的話,整個檔案的內容如下:
import java.io.File;
import java.util.List;
public class Flv {
public Flv(){};
public static void main(String[] args) {
Flv cv = new Flv();
boolean s = cv.getFLVFrameToImage(『D:/clock1.flv』,』3″, 『00:00:01″, 『mjpeg』, 『d:/test.jpg』, 『300×400″);
System.out.println(s);
}
/*
* 透過ffmpeg 抓 flv 檔的圖片
* 原指令:ffmpeg -y -i coke.flv -vframes 1 -ss 00:00:03 -an -vcodec mjpeg -f rawvideo -s 320×240 test.jpg
*/
public boolean getFLVFrameToImage(String sourceFilePath, String frames, String strdate, String outType, String outFilePath, String size) {
if(!checkFile(sourceFilePath)){
System.out.println(sourceFilePath+』 is not file』);
return false;
}
List<String> command=new java.util.ArrayList<String>();
command.add(『ffmpeg.exe』);
command.add(『-y』);
command.add(『-i』);
command.add(sourceFilePath);
command.add(『-vframes』);
command.add(frames);
command.add(『-ss』);
command.add(strdate);
command.add(『-an』);
command.add(『-vcodec』);
command.add(outType);
command.add(『-f』);
command.add(『rawvideo』);
command.add(『-s』);
command.add(size);
command.add(outFilePath);
return process(command);
}
public boolean process(List<String> command){
try {
System.out.println(command.toString());
ProcessBuilder builder = new ProcessBuilder();
builder.command(command);
builder.start();
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
java程式可在這裡下載
和javascript一樣,也可以減肥~~
網頁要美觀漂亮,目前多半都改用css來呈現
若要區分不同子功能有不同的style,設計時可能會是一個子功能會設計一個css檔
如果要同一網頁中把不同區塊用到的不同css,全都載入,css檔案小時,這沒問題,但如果檔案大時,下載速度又是一種考驗。
找到的工具有
Theme: Rubric. 在WordPress.com寫網誌.