php - 不使用 ffmpeg 将 flv 文件转换为 mp4 文件

标签 php ffmpeg centos

我为我的centos服务器安装了ffmpeg。然后我使用ffmpeg将我的flv文件转换为mp4。但是它创建了0字节错误的mp4文件。
转换代码

shell_exec('/usr/local/bin/ffmpeg -i ffmpeg/test1.flv-c copy -copyts ffmpeg/test.mp4');

ffmpeg 版本是
ffmpeg version N-75682-g5fa5e73 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
  configuration:
  libavutil      55.  2.100 / 55.  2.100
  libavcodec     57.  3.100 / 57.  3.100
  libavformat    57.  2.102 / 57.  2.102
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6.  9.101 /  6.  9.101
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfi     
le}...

运行后,我得到以下输出
ffmpeg version N-75682-g5fa5e73 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
  configuration:
  libavutil      55.  2.100 / 55.  2.100
  libavcodec     57.  3.100 / 57.  3.100
  libavformat    57.  2.102 / 57.  2.102
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6.  9.101 /  6.  9.101
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
Input #0, flv, from 'ffmpeg/test1.flv':
  Metadata:
    starttime       : 0
    totalduration   : 67
    totaldatarate   : 354
    bytelength      : 2954448
    canseekontime   : true
    sourcedata      : BD075F34AHM1443878448533564
    purl            :
    pmsg            :
    httphostheader  : r7---sn-xupn5a5u-4wge7.googlevideo.com
  Duration: 00:01:06.63, start: 0.000000, bitrate: 354 kb/s
    Stream #0:0: Video: flv1, yuv420p, 426x240, 288 kb/s, 30 fps, 30 tbr, 1k tbn                                                                                                                                                             , 1k tbc
    Stream #0:1: Audio: mp3, 22050 Hz, mono, s16p, 65 kb/s
[aac @ 0x2b4b640] The encoder 'aac' is experimental but experimental codecs are                                                                                                                                                              not enabled, add '-strict -2' if you want to use it.

最佳答案

请试试这个

/usr/local/bin/ffmpeg -i ffmpeg/test1.flv -strict -2 ffmpeg/test1.mp4

它会起作用的。

关于php - 不使用 ffmpeg 将 flv 文件转换为 mp4 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32921605/

相关文章:

PHP chmod() 无法在服务器上运行

javascript - 页面上的任何按钮都会发送表单,即使是表单标签之外的按钮

php - 属性(property)不存在但关系已建立

Android 内置相机编码器 VS FFMPEG --- 速度

ffmpeg 在同一个文件中对一个输入视频流和多个输出视频流进行转码

ffmpeg - 我可以使用 ffmpeg 将 JPEG 输出到内存流而不是文件吗?

php - 使用php按第5维值中的日期对5维数组进行排序?

PHP numfmt_create 调用未定义的函数

docker-compose -/bin/sh : url: command not found

linux - Centos kernel-devel 安装后不可用