简体   繁体   English

从传输流中提取音频并保留长度

[英]Extract audio from Transport Stream and preserve length

I'm using ffmpeg to extract audio from MPEG Transport Stream file recorded by DVB-S card. 我正在使用ffmpeg从DVB-S卡录制的MPEG Transport Stream文件中提取音频。 The command: 命令:

ffmpeg -i video.ts -vn audio.wav

The source file seems to be corrupted. 源文件似乎已损坏。 I noticed the corruption happens from time to time, especially for videos longer than 1 hour. 我注意到损坏有时会发生,尤其是对于超过1小时的视频。 I've got errors like these: 我有这样的错误:

[mp2 @ 0x1bb5500] Header missing
Error while decoding stream #0:1
[mpegts @ 0x17eaf40] Continuity check failed for pid 5261 expected 2 got 6

The problem is that the resulting audio.wav is shorter than the source video (40m33s and 40m59s accordingly). 问题在于生成的audio.wav比源视频短(相应地为40m33s和40m59s)。 I'm looking for the way to preserve the original length in the resulting audio file. 我正在寻找在生成的音频文件中保留原始长度的方法。

I tried the recent ffmpeg under Windows and avconv under Ubuntu, output format was MP3 and WAV. 我在Windows下尝试了最近的ffmpeg,在Ubuntu下尝试了avconv,输出格式为MP3和WAV。 For every case I've got the same results. 对于每种情况,我都有相同的结果。

I didn't find whether it's possible to do it with ffmpeg however I found ProjectX - a tool which tries to fix the broken TS stream. 我没有发现是否可以用ffmpeg做到这一点,但是我找到了ProjectX-一种试图修复损坏的TS流的工具。 Website: http://project-x.sourceforge.net/ 网站: http//project-x.sourceforge.net/

With: 附:

java -jar ProjectX.jar -demux my_video.ts

the stream is demuxed into audio and video files which are guaranteed to have the same length. 流将被解复用为音频和视频文件,并保证它们具有相同的长度。 I simply mux them back using ffmpeg. 我只是使用ffmpeg将它们混和回去。

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

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