首页 \ 问答 \ 问题与FFMPEG和PHP(Problem with FFMPEG and PHP)

问题与FFMPEG和PHP(Problem with FFMPEG and PHP)

我知道这本身不是一个编程问题,而是一个设置问题,但仍然是:

我正在尝试使用PHP脚本将FFMPEG视频转换为以下教程:

http://vexxhost.com/blog/2007/05/20/how-to-convertencode-files-to-flv-using-ffmpeg-php/

FFMPEG完美工作,并且我多次从命令行使用它。 PHP也似乎工作正常。 我也安装了ffmpeg-php,它似乎在加载文件。

问题在于我尝试在PHP中执行以下操作:

$ srcFile =“p1.avi”;

$ ffmpegObj = new ffmpeg_movie($ srcFile);

不管怎样,PHP都会返回这个:

警告:无法在第xx行的/var/www/converter.php中打开电影文件p1.avi

很显然,无论我以后用$ ffmpegObj做的任何调用都会导致一个致命的错误。 我绝对坚持下去,广泛的谷歌搜索没有多大帮助。

如果您必须知道,我使用Ubuntu 9.04以及默认的LAMP服务器软件包以及php5-ffmpeg,并且我已经编译了ffmpeg,遵循我在Ubuntuforums上找到的教程(我会链接到它,但是stackoverflow不会让我)

谢谢!


I know this isn't exactly a programming question per se, but rather a settings question, but still:

I'm trying to convert video with FFMPEG with a PHP script, following this tutorial:

http://vexxhost.com/blog/2007/05/20/how-to-convertencode-files-to-flv-using-ffmpeg-php/

FFMPEG works perfectly and I've used it from the command line a number of times. PHP also seems to work fine. I've also installed ffmpeg-php and it seems to be loading file.

The problem lies when I try to do the following in PHP:

$srcFile = "p1.avi";

$ffmpegObj = new ffmpeg_movie($srcFile);

No matter what, PHP will return this:

Warning: can't open movie file p1.avi in /var/www/converter.php on line xx

Obviously, whatever call I do afterwards with $ffmpegObj will throw a fatal error. I'm absolutely stuck and extensive googling hasn't helped much.

If you must know, I'm using Ubuntu 9.04 with the default LAMP server packages as well as php5-ffmpeg, and I've compiled ffmpeg following a tutorial I found on Ubuntuforums (I'd link to it but stackoverflow won't let me)

Thanks!


原文:https://stackoverflow.com/questions/1868867
更新时间:2022-06-13 14:06

最满意答案

因为这就是语言规范所说的。 语法的相关位是

Expression: 
     Expression1 [AssignmentOperator Expression1]

Expression1: 
     Expression2 [Expression1Rest]

Expression1Rest: 
     ? Expression : Expression1

Expression2:
     Expression3 [Expression2Rest]

Expression2Rest:
     { InfixOp Expression3 }
     instanceof Type


InfixOp: 
     || 
     &&
     // and many other operators

所以解析A || B ? C : D A || B ? C : D A || B ? C : D? C : D必须是Expression1Rest ,并且||的右侧 必须是Expression3 ,其中不包含三元条件表达式(除非它包含在圆括号中 - 括号表达式总是可以作为Expression3 )。 所以我们必须解析A || B A || B作为Expression3 ,因此整个表达就好像它是(A || B) ? C : D (A || B) ? C : D


Because that's what the language specification says. The relevant bits of the grammar are

Expression: 
     Expression1 [AssignmentOperator Expression1]

Expression1: 
     Expression2 [Expression1Rest]

Expression1Rest: 
     ? Expression : Expression1

Expression2:
     Expression3 [Expression2Rest]

Expression2Rest:
     { InfixOp Expression3 }
     instanceof Type


InfixOp: 
     || 
     &&
     // and many other operators

So to parse A || B ? C : D, the ? C : D must be an Expression1Rest, and the right hand side of a || must be an Expression3, which does not include a ternary conditional expression (unless it is wrapped in parentheses - a parenthesized expression is always acceptable as an Expression3). So we must parse the A || B as an Expression3, and thus the whole expression as if it were (A || B) ? C : D.

相关问答

更多
  • Thymeleaf 3是否支持多种三元条件,例如: cond1 ? do1 : cond2 ? do2 : do3 是的,它确实。 用括号括起第二个三元运算符以摆脱解析异常。 cond1 ? do1 : (cond2 ? do2 : do3) 应用后,您的表达应该有效。 Does Thymeleaf 3 support multiple ternary conditions, such as: cond1 ? do1 : cond2 ? do2 : do3 Yes, it does. Just enclos ...
  • 因为这就是语言规范所说的。 语法的相关位是 Expression: Expression1 [AssignmentOperator Expression1] Expression1: Expression2 [Expression1Rest] Expression1Rest: ? Expression : Expression1 Expression2: Expression3 [Expression2Rest] Expression2Rest: ...
  • 看起来你对“更高优先级”的含义感到困惑。 我们用一个简单的例子来解释一下: 运算符*优先级高于运算符'+'。 这意味着表达式a*b+c的评估类似于(a*b)+c 。 这同样适用于&&运算符和三元运算符: &&优先级高于运营商? : ? : 。 这意味着表达式a&&b?c:d被评估为(a&&b)?c:d 。 因此,运算符优先级的工作方式与示例中记录的相同。 它完全符合你的要求: if (a.getItem() != null && a.getItem().getOtherItem() != null? ...
  • 因为你不能像Java那样分配一个语句。 如果你使用它,你的三元组会工作, System.out.println(i%2==0 ? "even" : "odd"); 从根本上讲,Java不是C. 编辑 你在评论中询问, 我在哪里分配任何东西 ? 引用Equality,Relational和Conditional Operators(The Java Tutorials) , 另一个条件运算符是?: ,它可以被认为是if-then-else语句的简写(在本课的控制流程语句部分讨论过)。 该运算符也称为三元运算 ...
  • 它短路是正常的,但不是你想要它的方式。 &&的优先级高于三元?: - 因此(缩进,换行符和注释添加以澄清) ((Score) object).getValue().equals(value) && literal == null ? ((Score) object).getLiteral() == null : literal.equals(((Score) object).getLi ...
  • 你猜对了:它是优先的。 运算符-在三元运算符之前进行评估。 var y = bar(2,2) - (flag) ? x : 0; 被评估为 var y = (bar(2,2) - (flag)) ? x : 0; 您可以在此处查看运算符优先级: https : //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence 请注意,“条件”(三元)运算符在列表中是向下的。 You gues ...
  • (field = value) instanceof String 假设它已满足您的需求(因此它包括当value null时返回false),那么就会有更短的替代方案 (field = value) != null 或者,如果您实际上忽略了这一点,并希望将null返回true ,那么请使用 (field = value) == value 如果使用单字母变量名,则可以缩短此时间。 此外,我没有看到其他方式,我同意我们大多数人,这一切都有点讨厌;) (field = value) instanceof ...
  • 我想你可能想要使用null无煤运算符,这是?? // y = x, unless x is null, in which case y = -1. int y = x ?? -1; 来自?? 操作员文档 While all of the other answers seem valid, none of them work for me. Since I was calling this GetRecords() method from a JsonResult controller me ...
  • 当编译器发现一个? 字符,它寻找一个对应的: 。 之前的表达式? 是表示条件的三元条件运算符的第一个操作数。 之间的表达式? 和:是运算符的第二个操作数,如果条件为真,则返回其值。 :之后的表达式是运算符的第三个操作数,如果条件为false,则返回其值。 boolean t1 = false ? false : true?false:true?false:true; first second third operan ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)