douhao7889 2018-05-14 06:31
浏览 259
已采纳

2>&1并同时记录日志文件

I'm using this code to run ffmpeg and return when it succeeded or failed using 2> & 1 and $var. The problem is that I would also like to generate a log.txt with the current ffmpeg process. I know it does using 2> log.txt but how do I use both options at the same time?

<?php
$ffmpeg = '"D:\FFMPEG\bin\ffmpeg.exe"' . " -loglevel verbose -n -i https://URLVIDEO -map p:0 -acodec copy -bsf:a aac_adtstoasc -vcodec copy video.mp4 2>&1";

    exec($ffmpeg, $output, $var);

    if($var){
       echo 'error';
    }else{

      echo 'success';

    }
?>
  • 写回答

2条回答 默认 最新

  • duanba7653 2018-05-14 06:33
    关注

    Use 1> log.txt 2>&1.

    stdout is redirected to the log file and stderr is appended to stdout.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?