简体   繁体   English

ffmpeg 相当于 sox -t ima

[英]ffmpeg equivalent for sox -t ima

I am trying to use ffmpeg to combine 1 audio file (ADPCM) and 1 video file (h264) into single mp4.我正在尝试使用 ffmpeg 将 1 个音频文件 (ADPCM) 和 1 个视频文件 (h264) 组合成单个 mp4。 Video by file conversion works fine but ffmpeg chokes on guessing audio input.通过文件转换的视频工作正常,但 ffmpeg 在猜测音频输入时会阻塞。 I can't figure out how to tell ffmpeg which params to use to decode raw audio file.我不知道如何告诉 ffmpeg 使用哪些参数来解码原始音频文件。

Currently I first run sox to convert raw audio to wav:目前我首先运行 sox 将原始音频转换为 wav:

sox -t ima -r 8000 audio.raw audio.wav

... then feed audio.wav from sox as ffmpeg input ...然后将 sox 中的 audio.wav 作为 ffmpeg 输入

ffmpeg -i video.raw -i audio.wav movie.mp4

I am trying to avoid sox step and use audio.raw in ffmpeg.我试图避免 sox 步骤并在 ffmpeg 中使用 audio.raw。

Thank you谢谢

Since you have headless audio, you should tell ffmpeg about the sample format and (optionally) sample rate, audio channels, eg:由于您有无头音频,您应该告诉 ffmpeg 样本格式和(可选)采样率、音频通道,例如:

ffmpeg -i video.raw -f s16le -ar 22050 -ac 1 -i audio.raw movie.mp4

To check supported PCM formats you may use this command:要检查支持的 PCM 格式,您可以使用此命令:

ffmpeg -formats 2>&1 | grep -i pcm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM