就像优酷或其它视频网站一样,在进入视频前不是都有一张图片吗,请问这张图片如何获取

解决方案 »

  1.   

    恩,这个问题提的好,但是你去查看网页的源代码后就很容易知道他是怎么做出来了
    就是一张图片,加一个超链接。。如:
     <a href="http://v.youku.com/v_show/id_XOTMzNTcwODQ=.html" target="video" id="XOTMzNTcwODQ=" name="hotVideoList" charset="100-003-1"><img src="http://vimg16.yoqoo.com/0100641F464A17868FFB8C003B7E6C591D0FD9-C046-8CB1-DBF8-FF1DAB487419" alt="墨城5.7强震再引恐慌   "/></a>
     
      

  2.   

    用ffmpeg 对视频指定时间截取图片 还可以转换格式
      

  3.   

    用ffmpeg 对视频指定时间截取图片 还可以转换格式
      

  4.   

    import java.io.File;
    import java.util.List;
    import java.util.ArrayList;public class ChangeVedio { // resourcePath为原来视频文件的路径
    // filename:要转换成FLV的文件名
    // realpath:实际存放FLV的路径
    public static boolean process(String resourcePath, String fileName,
    String realPath) { int type = checkContentType(resourcePath); boolean status = false; // 如果符合转换文件类型
    if (type == 0) { status = processFLV(resourcePath, fileName, realPath);
    }
    return status;
    } // 检查文件的类型
    private static int checkContentType(String resourcePath) {
    String type = resourcePath.substring(resourcePath.lastIndexOf(".") + 1,
    resourcePath.length()).toLowerCase(); if (type.equals("avi")) {
    return 0;
    } else if (type.equals("mpg")) {
    return 0;
    } else if (type.equals("wmv")) {
    return 0;
    } else if (type.equals("3gp")) {
    return 0;
    } else if (type.equals("mov")) {
    return 0;
    } else if (type.equals("mp4")) {
    return 0;
    } else if (type.equals("asf")) {
    return 0;
    } else if (type.equals("asx")) {
    return 0;
    } else if (type.equals("flv")) {
    return 0;
    } else if (type.equals("mpeg")) {
    return 0;
    } else if (type.equals("mpe")) {
    return 0;
    } else if (type.equals("wmv9")) {
    return 1;
    } else if (type.equals("rm")) {
    return 1;
    } else if (type.equals("rmvb")) {
    return 1;
    }
    return 9;
    } private static boolean checkfile(String path) {
    File file = new File(path);
    if (!file.isFile()) {
    return false;
    }
    return true;
    } private static boolean processFLV(String resourcePath, String fileName,
    String realPath) { if (!checkfile(resourcePath)) {
    System.out.println(resourcePath + " is not file");
    return false;
    }
    try {
    Runtime runtime = Runtime.getRuntime();
    Process proce;
    String cmd = "";
    String realPath1 = realPath + "//Vedio//";
    String realPath2 = realPath + "//Vedio//";
    Runtime runtime1 = Runtime.getRuntime();
    Process proce1;
    proce1 = runtime1.exec("c://encoder.bat " + resourcePath + " "+ realPath2 + fileName);
    proce1.waitFor();
    proce = runtime.exec("c://makeing.bat " + resourcePath + " "
    + realPath1 + fileName + ".jpg");
    proce.waitFor();
    System.out.println(realPath2 + fileName);
    //File flvFile = new File(realPath2 + fileName); // 如果转换成功,文件存在并且长度>0
    //boolean success = flvFile.exists() && flvFile.length() > 0; return true;
    } catch (Exception e) {
    e.printStackTrace();
    return false;
    }
    } public static void main(String[] args) { //System.out.println("处理中......");
    //if (process("D://KISS.mp4", "rexue.flv", "D://transfer")) {
    // System.out.println("ok");
    // //最好在D盘 里一个文件夹 d:transfer\Vedio
    //}
    String s="ab.cd.e.fg";
    String[] str=s.split("\\.");
    System.out.println(str[1]);
    }}