dreamwind1985 2014-03-24 02:29
浏览 362
已采纳

从视频中提取帧 - PHP-FFMpeg

I am using php ffmpeg in a laravel project, to do multiple things probe, extract frame and encode. I am having an issue when creating a frame from the uploaded video file. This is how the frame is created:

    $video = $ffmpeg->open($destinationPath.'/'.$filename);

    $video
        ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
        ->save(public_path().$frame_path);

This is sometimes working and creates the frame but other times is not. I noticed that this bug comes up when I am trying to open a .mov file.

  • 写回答

3条回答 默认 最新

  • douyangcheng4965 2014-03-24 04:02
    关注

    It's possible that your version of ffmpeg does not support the codec that is used in the source video file, and hence it is not able to decompress the video and extract an image.

    You could try processing the file from the command line to see if you can extract an image that way, and ffmpeg may give you some more information on the problem.

    An example command line to extract a png frame from a video file

    ffmpeg -y -ss 30 -i [source_file] -vframes 1 [target_file]
    

    Add -f image2 as an output option if your output name is a variable.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 图片是GET请求,后面是图片的id,Glide如何缓存?
  • ¥15 现代密码学问题求解答
  • ¥15 关于C#与NICAN类库通信的问题
  • ¥15 cytoscape问题
  • ¥15 putty实现机器学习猫狗识别
  • ¥15 STS/eclipse导入gradle项目时报错如下
  • ¥15 centos7.6进不去系统,卡在数字7界面
  • ¥15 Tensorflow采用interpreter.allocate_tensors()分配内存出现ValueError: vector too long报错
  • ¥15 使用CGenFF在线生成血红素辅基拓扑结构遇到问题
  • ¥20 matlab代码实现可达矩阵形成骨骼矩阵
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部