video - ffmpeg -bsf :v h264_mp4 toannexb not working in debien

标签 video ffmpeg

我必须在视频中附加音频并将输出与另一个视频 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 包,以供其他可能依赖它的包使用。
  • 如果 ffmpeg命令仍然执行旧的、糟糕的版本,然后你当前的 shell session 正在记住旧的位置。运行hash -r或只是注销/登录。你只需要这样做一次。
  • 如果您愿意,可以compile 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/

    相关文章:

    ffmpeg - windows上使用ffmpeg将一组png图片转换为一组webp图片

    android - 顺序显示位图, "like a video"

    ffmpeg - 如何在 Windows 10 上的 ffmpeg 中从 yuyv422 切换到 yuv420p 以获得更好的帧率

    ffmpeg - 使用 libavformat : VBV buffer size not set, 多路复用的视频流错误可能会失败

    video - 如何使用ffmpeg连接2个视频并在它们之间添加一段静音+黑屏?

    Android - 录制视频时在前后摄像头之间切换

    ios - AV Framework 前置摄像头问题

    ffmpeg - 拆分电影,使每个 GIF 都在特定文件大小之下

    video - UIImagePickerController - 相机未准备好

    video - ffmpeg 可以从文件中的特定位置解析吗?