我希望在 mp3、aac 或 vorbis 编解码器中创建一个长度正好为 30 秒的输出文件。我已经通过以下命令使用了 avconv(也尝试了 ffmpeg):
avconv -i input_file_here -c:a aac -b:a 320k -t 30 out.mp4
这会产生输出,说明它已经编码了 30 秒,但随后:
$ avprobe out.mp4
avprobe version v13_dev0-1648-gc4642788e, Copyright (c) 2007-2018 the Libav developers
built on Apr 24 2019 15:49:35 with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf57.83.100
Duration: 00:00:30.02, start: 0.023220, bitrate: 323 kb/s
Stream #0:0(und): Audio: aac (LC) [mp4a / 0x6134706D]
44100 Hz, stereo, fltp, 321 kb/s (default)
Metadata:
handler_name : SoundHandler
# avprobe output
当我在 mp3 中编码时,它正确显示它在编码过程中超过 30 秒。当我尝试使用 vorbis 时,它的运行时间略少于 30 秒。
是否可以使用任何工具(我更喜欢 avconv)来实现 30 秒到毫秒的长度。