gpt4 book ai didi

audio - ffmpeg 从 .ts 文件中仅提取 1 个音频流的一部分

转载 作者:行者123 更新时间:2023-12-03 01:15:10 24 4
gpt4 key购买 nike

这是ffprobe input.ts显示:

  libavutil     56. 55.100 / 56. 55.100
libavcodec 58. 93.100 / 58. 93.100
libavformat 58. 47.100 / 58. 47.100
libavdevice 58. 11.100 / 58. 11.100
libavfilter 7. 86.100 / 7. 86.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Input #0, mpegts, from 'D:\Downloads\TEST\audio.ts':
Duration: 02:22:29.67, start: 0.000000, bitrate: 51 kb/s
Program 1
Stream #0:0[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 83 kb/s
所以 .ts 文件的长度是 2h:22m:29.67s 并且看起来它只包含音频 (AAC):当我在 Windows Media Player 中打开它时,我可以跳转到 2h:22m 范围内的任意位置并听到声音播放,屏幕上没有视频。这让我认为提取的音频也将是 2h:22m 长度,但我只得到 51m:14s 文件。我尝试了以下命令:1) ffmpeg -i input.ts -vn -acodec copy outputaudio.aac 2) ffmpeg -i input.ts -map 0:v -map 0:a -c copy outputaudio.aac (据我了解,这是“提取所有音轨”命令)3) ffmpeg -i input.ts -ss 00:00:00 -t 02:22:29.6 -q:a 0 -map a outputaudio.aac (到 强制 提取到全长,即 2h:22m)4) ffmpeg -i input.ts -map 0:a outputaudio.aac -map 0:v outputonlyvideo.avi (我听说这是通过同时提取视频来强制提取全长音频的另一种方法。虽然看起来我的 .ts 没有视频,但我决定也尝试此命令并收到错误消息: 流图'0:v' 不匹配任何流 )我做错了什么?我可以尝试哪些替代命令?是否有可能,音频流的实际长度仅为 51m:14s?但是为什么我可以在 Windows Media Player 中收听所有 2h:22m 长度 - 51m:14s 片段能否以某种方式在 .ts 内循环以产生 2h:22m 长度的印象?

最佳答案

要通过使用静音插入时间戳间隙来保持持续时间,请使用 aresample 过滤器。

ffmpeg -i input.ts -map 0:a -af aresample=async=1 -ss 00:00:00 -t 02:22:29.6 -q:a 0 output.aac

关于audio - ffmpeg 从 .ts 文件中仅提取 1 个音频流的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62692355/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com