duanleiliu7373 2017-03-17 14:03
浏览 319
已采纳

通过PHP合并两个视频

So, I'm trying to merge two files using PHP and I've taken a look at the FFMpeg library, yet I cannot manage to merge them. Here's what I've got so far:

$ffmpeg = FFMpeg\FFMpeg::create();
$vid1 = $ffmpeg->open('videos/vid1.mp4');
$vid2 = $ffmpeg->open('videos/vid2.mp4');

How do I stitch together $vid1 and $vid2 and save them?

Thanks

  • 写回答

1条回答 默认 最新

  • dongmu4591 2017-03-17 20:38
    关注

    You can concatenate files directly by using shell_exec().

    See FFmpeg Concatenate

    Usage:

    shell_exec( "G:/ffmpeg/ffmpeg.exe -f concat -safe 0 -i G:/ffmpeg/concatenate.txt -c copy G:/ffmpeg/phpconcatenated.mp4" )
    

    concatenate.txt includes names of files you want to merge.

    # Example concatenate.txt
    file 'G:/ffmpeg/input.mp4'
    file 'G:/ffmpeg/input_2.mp4'
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料