问题与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
最满意答案
因为这就是语言规范所说的。 语法的相关位是
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 anExpression1Rest
, and the right hand side of a||
must be anExpression3
, which does not include a ternary conditional expression (unless it is wrapped in parentheses - a parenthesized expression is always acceptable as anExpression3
). So we must parse theA || B
as anExpression3
, and thus the whole expression as if it were(A || B) ? C : D
.
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
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语句的简写(在本课的控制流程语句部分讨论过)。 该运算符也称为三元运算 ...
-
三元运算符在条件未满足时评估条件语句(Ternary operator evaluating conditional statement while condition not met)[2022-12-31]
它短路是正常的,但不是你想要它的方式。 &&的优先级高于三元?: - 因此(缩进,换行符和注释添加以澄清) ((Score) object).getValue().equals(value) && literal == null ? ((Score ) object).getLiteral() == null : literal.equals(((Score ) object).getLi ... -
javascript:使用三元运算符的意外评估行为(javascript: Unexpected Evaluation Behavior with Ternary Operator)[2022-11-08]
你猜对了:它是优先的。 运算符-在三元运算符之前进行评估。 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 ... -
java三元黑客(java ternary hack)[2023-10-20]
(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 ...