【问题标题】:thumbnail of video in php while uploading [duplicate]上传时php中的视频缩略图[重复]
【发布时间】:2011-01-16 21:58:12
【问题描述】:

可能重复:
How to create thumbnails or preview for videos?

我制作了视频库。我想要那个视频的缩略图,比如 youtube。在 php 中上传时如何获得它。

【问题讨论】:

    标签: php video


    【解决方案1】:

    【讨论】:

    • 不知道这是否会在上传时起作用,但我仍然给 +1 :)
    • @rajanikant:只需下载并将其复制到 php 扩展目录,然后在 php.ini 和扩展部分中的条目(搜索“扩展”,您将看到如何做到这一点)扩展名)
    • 然后在上传时给我工作思路
    【解决方案2】:

    使用以下两行来使用 ffmpeg 从视频创建图像

    $str_command= $ffmpeg  ." -i " . $image_source_path . $image_cmd .$dest_image_path;     
    shell_exec($str_command);
    

    请在下面找到变量解释:

    $ffmpeg ="Document path to your ffmpeg";
    $image_source_path = "Document path to your video"
    $image_cmd = " -r 1 -ss 00:00:10 -t 00:00:01 -s ".ALL_PLACE_WIDTH."x".ALL_PLACE_HEIGHT."   -f image2 " ;
        Where ALL_PLACE_WIDTH ="width of the image you want"
        ALL_PLACE_HEIGHT ="heoght of the image you want"
    
    $dest_image_path = "Document path to your image which is going to create"
    

    这将在 10 秒后从您的视频中捕获图像。

    FFMPEG

    希望这会有所帮助。

    【讨论】:

    • 但是我如何安装 FFMPEG
    • 从这里下载最新版本。 ffdshow.faireal.net/mirror/ffmpeg 并将 ffmpeg.exe 放置在您的文件夹结构中任何您想要的位置,并在变量 $ffmpeg 中提供上述代码的路径。我还在我的答案 chk 中添加了 ffmpeg 的链接。
    • 我试过 ffmpeg -if:\Videos\amazing_mccullum_catch.flv -r 1 -t 00:00:30 -f image2 -s 120x72 /withfr/tnails/final%01d.png 和 ffmpeg - if:\Videos\amazing_mccullum_catch.flv -r 1 -t 00:00:01 -ss 00:00:30 -f image2 -s 120x72 /withfr/tnails/final%01d.png 从视频的第 30 秒,但它返回了不止一张图像.. 为什么?
    • 可能你已经在循环中使用了它......
    • 不,我没有使用循环,我只是在命令行客户端中尝试过。但是生成的图片太多
    猜你喜欢
    • 2021-04-24
    • 2016-09-14
    • 1970-01-01
    • 2019-06-08
    • 2011-08-11
    • 1970-01-01
    • 2012-05-19
    • 2016-03-26
    • 1970-01-01
    相关资源
    最近更新 更多