ffmpeg - 如何在 FFmpeg 4.0 中将 5.1 音频拆分为离散的 AAC 流

标签 ffmpeg mp4 acc

在 FFmpeg v4.0 之前,我已经能够对包含 H.264 视频轨道和 AC3 或 DTS 音频流的输入视频文件运行以下命令,并生成具有 6 个音频流的 MP4。每个流对应一个 5.1 音频的 channel 。

ffmpeg -i INPUT.MKV -vcodec copy -filter_complex channelsplit=channel_layout=5.1 -acodec aac -movflags faststart OUTPUT.MP4
它甚至可以在立体声轨道上工作,并将 L 和 R channel 放在适当的位置,并为其他 4 个 channel 生成一些无关紧要的静音轨道。
但现在在 v4.0.1 中,我收到以下错误:

[aac @ 0x7f7f65001e00] Unsupported channel layout

Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Conversion failed!


将命令更改为以下内容并不能改善问题:
ffmpeg -i INPUT.MKV -vcodec copy -filter_complex "channelsplit=channel_layout=5.1[FL][FR][FC][LFE][BL][BR]" -acodec aac -movflags faststart OUTPUT.MP4
它给出了以下错误:

Filter channelsplit:BR has an unconnected output


(注意 BL/BR 和 SL/SR 都产生关于 BR 的相同错误)
这种 MP4 文件结构对于在 Unity 内部使用放置在环境中的虚拟扬声器进行回放非常有用。
我的最终目标:
- MP4 (MOOV Atom at the Front)
    -H.264 Video Stream
    -AAC Audio Stream - FL
    -AAC Audio Stream - FR
    -AAC Audio Stream - FC
    -AAC Audio Stream - LFE
    -AAC Audio Stream - SL
    -AAC Audio Stream - SR

最佳答案

这就是您设置新布局和 map 的方式。

ffmpeg -i INPUT.MKV
       -filter_complex "channelsplit=channel_layout=5.1[FL][FR][FC][LFE][BL][BR];
                        [FL]aformat=channel_layouts=mono[FL];
                        [FR]aformat=channel_layouts=mono[FR];
                        [FC]aformat=channel_layouts=mono[FC];
                        [LFE]aformat=channel_layouts=mono[LFE];
                        [BL]aformat=channel_layouts=mono[BL];
                        [BR]aformat=channel_layouts=mono[BR]"
       -map 0:v -map '[FL]' -map '[FR]' -map '[FC]' -map '[LFE]' -map '[BL]' -map '[BR]'
       -vcodec copy -acodec aac -movflags faststart OUTPUT.MP4

关于ffmpeg - 如何在 FFmpeg 4.0 中将 5.1 音频拆分为离散的 AAC 流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50936501/

相关文章:

android - Flutter_ffmpeg : At least one output file must be specified

ffmpeg - 使用 ffmpeg 将 h.264 avi 容器转换为 mp4

java - 用Java和ffmpeg查找视频的长度

在 HP-UX 上使用 Swig 时 Java 崩溃

c++ - 基于 ffmpeg 的多线程 C++ 应用程序解码失败

php - 使用 php GD 创建 MP4 视频缩略图

php - ffmpeg - 如何确定是否启用了 -movflags faststart? PHP

ffmpeg - 如何使用 .MP4 或 .TS 文件生成 CVBR AV 文件

machine-learning - F1 分数是衡量平衡数据集的良好指标吗

c++ - Hpux C程序中__(两个下划线)代表什么