ffmpeg 0.5 flv 到 wav 转换创建其他程序无法打开的 wav 文件
我使用以下命令将 FLV 文件转换为音频文件,以输入到 julian(一个语音转文本程序)中。
cat ./jon2.flv | ffmpeg -i - -vn -acodec pcm_s16le -ar 16000 -ac 1 -f wav - | cat - > jon2.wav
cat 的存在是为了调试目的,因为最终用途将是一个正在运行的程序,它将 FLV 通过管道传输到 ffmpeg 的标准输入,并将标准输出传输到 julian。
生成的波形文件由“文件”标识为:
jon3.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz
VLC(基于 ffmpeg)播放该文件,但没有其他工具可以打开/查看数据。它们显示空的 wav 文件或无法打开/播放。例如 CS4 中的 Sound Booth。
还有其他人遇到过类似的问题吗? Julian 需要 16000 Hz 的 16 位单声道 wav 文件。朱利安似乎确实读取了该文件,但似乎没有浏览整个文件(可能不相关)。
谢谢,
-rr
I am using the following command to convert FLV files to audio files to feed into julian, a speech to text program.
cat ./jon2.flv | ffmpeg -i - -vn -acodec pcm_s16le -ar 16000 -ac 1 -f wav - | cat - > jon2.wav
The cat's are there for debugging purposes as the final use will be a running program that will pipe FLV into ffmpeg's stdin and the stdout going to julian.
The resulting wave files are identified by "file" as:
jon3.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz
VLC (based on ffmpeg) plays the file, but no other tools will open/see the data. They show empty wav files or won't open/play. For example Sound Booth from CS4.
Has anyone else had similar problems? Julian requires wav files 16bit mono at 16000 Hz. Julian does seem to read the file, but doesn't seem to go through the entire file (may be unrelated).
Thanks,
-rr
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试让 ffmpeg 直接操作输入/输出文件,而不是通过管道将数据传入和传出 ffmpeg:
ffmpeg -i INPUT_FILE.FLV -vn -acodec pcm_s16le -ar 16000 -ac 1 -f wav OUTPUT_FILE.WAV
问题可能是因为您正在向 ffmpeg 提供一个流,并要求它写入一个流,所以它要么不知道输入流的长度,或者更有可能的是,它无法返回并重写标头中的长度数据输出文件的。
Try having ffmpeg directly operate on the input/output files, instead of piping data into and out of ffmpeg:
ffmpeg -i INPUT_FILE.FLV -vn -acodec pcm_s16le -ar 16000 -ac 1 -f wav OUTPUT_FILE.WAV
The problem may be that because you are feeding ffmpeg a stream, and asking it to write a stream, it either does not know the input stream's length, or, more likely, it cannot go back and rewrite the length data in the header of the output file.
问题可能是,对于 RIFF,字节 4 到 7 是存储文件长度(字节)的位置,而在写入时,文件长度尚不清楚。 VLC 可能会忽略 RIFF 标头中的值,从而允许它在那里播放,但不能在其他地方播放。
我发现的唯一解决方案是修改目标以忽略 RIFF 标头的长度。
Wave 文件头的结构描述如下:
http://www.sonicspot.com/guide/wavefiles.html
The problem is likely that with RIFF, bytes 4 through 7 is where the file length (bytes) is stored which, at the time it is being written, is not yet known. VLC likely ignores the value from the RIFF header allowing it to play there, but not play elsewhere.
The only solution I found was to modify the target to ignore the length from the RIFF header as well.
The structure of the Wave File Header is described here:
http://www.sonicspot.com/guide/wavefiles.html