dreamwind1985 2014-03-24 10:29
浏览 361
已采纳

从视频中提取帧 - 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 12: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 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题