简体   繁体   English

将.mov转换为.mp4 php的问题

[英]Issue in converting .mov to .mp4 php

I am trying to convert a video with extension .mov to .mp4 format. 我正在尝试将扩展名为.mov的视频转换为.mp4格式。 Following is the command that I try to use 以下是我尝试使用的命令

$file_name = "abc.mov";

$mp4_file  = "abc.mp4";

$cmd = 'sudo /usr/bin/ffmpeg -i /path_to_file' . $file_name . ' -strict experimental -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -preset slower -crf 18 -vf "scale=trunc(in_w/2)*2:trunc(in_h/2)*2" /destination_path/' . $mp4_file;
exec($cmd, $out, $res);

However the desired file( with .mp4 ) is not getting created. 但是,没有创建所需的文件(带有.mp4)。 When I copy the command and paste it inside terminal, the file with the desired format is getting created. 当我复制命令并将其粘贴到终端中时,将创建具有所需格式的文件。 However same is not working with exec command in my php code. 但是,同样不能在我的php代码中使用exec命令。

I am not able to figure out the actual cause of issue, since it seems out to be strange. 我无法找出问题的真正原因,因为这似乎很奇怪。 Any help shall be appreciated. 任何帮助将不胜感激。 Thanks in advance 提前致谢

尝试在执行程序的末尾放置“ 2&> 1”吗?

Use this code it Work's for me :) 使用此代码对我有用:)

ffmpeg -i input.mov -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -preset slow -crf 22 -movflags +faststart output.mp4

Hope it help you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM