我必须在视频中附加音频并将输出与另一个视频 mp4 合并
我使用此代码将视频附加到音频
ffmpeg -i "out1.mp4" -i "desc1.mp3" -c:v copy -c:a aac -strict experimental "output2.mp4"
它在 Windows 中工作,但在我的服务器 lunix 中我有这个错误
root@ns:~# ffmpeg -i /var/www/hespress/17/out1.mp4 -i /var/www/hespress/17/desc1.mp3 -c:v copy -c:a aac -strict experimental /var/www/hespress/17/output2.mp4
ffmpeg version 0.8.20-6:0.8.20-0+deb7u1, Copyright (c) 2000-2014 the Libav developers
built on Jan 19 2017 11:13:36 with gcc 4.7.2
The ffmpeg program is only provided for script compatibility and will be removed
in a future release. It has been deprecated in the Libav project to allow for
incompatible command line syntax improvements in its replacement called avconv
(see Changelog for details). Please use avconv instead.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/hespress/17/out1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf53.21.1
Duration: 00:00:20.03, start: 0.000000, bitrate: 1374 kb/s
Stream #0.0(und): Video: h264 (Main), yuvj420p, 1280x720 [PAR 1:1 DAR 16:9], 1371 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc
[mp3 @ 0xa06c40] max_analyze_duration reached
Input #1, mp3, from '/var/www/hespress/17/desc1.mp3':
Metadata:
encoder : Lavf53.21.1
Duration: 00:00:19.53, start: 0.000000, bitrate: 192 kb/s
Stream #1.0: Audio: mp3, 44100 Hz, mono, s16, 192 kb/s
Unrecognized option 'c:v'
Failed to set value 'copy' for option 'c:v'
当我去合并两个文件时,我使用此代码
ffmpeg -i intro.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts '.$dossier.'/intermediate1.ts
在 Windows 中它的工作,但在服务器 debian 中我有这个错误
root@ns205125:~# ffmpeg -i /var/www/hespress/intro.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts /var/www/hespress/17/intermediate1.ts
ffmpeg version 0.8.20-6:0.8.20-0+deb7u1, Copyright (c) 2000-2014 the Libav developers
built on Jan 19 2017 11:13:36 with gcc 4.7.2
The ffmpeg program is only provided for script compatibility and will be removed
in a future release. It has been deprecated in the Libav project to allow for
incompatible command line syntax improvements in its replacement called avconv
(see Changelog for details). Please use avconv instead.
[aac @ 0x3938ba0] Input buffer exhausted before END element found
Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 30.00 (30/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/hespress/intro.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2017-03-27 23:03:04
Duration: 00:00:12.92, start: 0.000000, bitrate: 2598 kb/s
Stream #0.0(eng): Video: h264 (Baseline), yuv420p, 1280x720, 2479 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc
Metadata:
creation_time : 2017-03-27 23:03:04
Stream #0.1(eng): Audio: aac, 48000 Hz, mono, s16, 127 kb/s
Metadata:
creation_time : 2017-03-27 23:03:04
Unrecognized option 'c'
Failed to set value 'copy' for option 'c'
root@ns205125:~#
最佳答案
问题
您正在使用 ancient, dead, buggy, broken, useless, counterfeit " ffmpeg
" from Libav ,不是现代的,真实的ffmpeg
来自 FFmpeg。
解决方案
幸运的是,您可以轻松 download真实事物的最新版本并改用它:
wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz
tar xvf https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz
/usr/local/bin
sudo cp ffmpeg-git-*-64bit-static/ff* /usr/local/bin
现在您可以运行
ffmpeg
命令,它应该使用您下载的版本。 /usr/local/bin
中删除 FFmpeg 二进制文件即可。 .sudo rm -f /usr/local/bin/{ffmpeg,ffmpeg-10bit,ffprobe,ffserver}
笔记
ffmpeg
命令仍然执行旧的、糟糕的版本,然后你当前的 shell session 正在记住旧的位置。运行hash -r
或只是注销/登录。你只需要这样做一次。 ffmpeg
而不是依赖第三方提供二进制文件。 ffmpeg
然后你可以把它放在~/bin
而不是 /usr/local/bin
.然后运行 source ~/.profile
刷新PATH
或者只是注销/登录(您只需执行一次)。如果您没有 root 或 super 用户权限,这也适用。 关于video - ffmpeg -bsf :v h264_mp4 toannexb not working in debien,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43236718/