gpt4 book ai didi

python - 在 python 上使用 ffmpeg 将 mkv 转换为 mp3 时出现“不支持的输入采样率设置”错误

转载 作者:行者123 更新时间:2023-12-04 23:32:18 26 4
gpt4 key购买 nike

我在尝试通过 python 将一些 mkv 文件转换为 mp3 时遇到此错误。几乎所有文件都已转换,但有些文件正面临这个问题。
https://cdn.discordapp.com/attachments/663255565451001866/788424224661569596/Error.txt
请帮我解决这个问题。
从上面的不和谐链接中提取的 ffmpeg 输出:

ffmpeg version git-2020-06-04-7f81785 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200523
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 49.100 / 56. 49.100
libavcodec 58. 90.100 / 58. 90.100
libavformat 58. 44.100 / 58. 44.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 84.100 / 7. 84.100
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, matroska,webm, from 'J:\DC ED\Original\045 'Kimi no Egao ga Nani Yori mo Suki Datta' by 'Chicago Poodle'.mkv':
Metadata:
title : 045 'Kimi no Egao ga Nani Yori mo Suki Datta' by 'Chicago Poodle'.mkv
COPYRIGHT : © 2013 APTX4869 Fansub
creation_time : 2020-11-18T05:03:06.000000Z
COMPOSER : Chicago Poodle
ENCODER : Lavf58.44.100
Duration: 00:01:20.04, start: 0.000000, bitrate: 2023 kb/s
Stream #0:0(jpn): Video: hevc (Main), yuv420p(tv), 1440x1080 [SAR 4:3 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
Metadata:
title : VIDEO[AVC]
ENCODER : Lavc58.90.100 libx265
BPS-eng : 1831510
DURATION-eng : 00:01:20.039000000
NUMBER_OF_FRAMES-eng: 1919
NUMBER_OF_BYTES-eng: 18324032
_STATISTICS_WRITING_APP-eng: mkvmerge v49.0.0 ('Sick Of Losing Soulmates') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2020-11-18 05:03:06
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(jpn): Audio: aac (LC), 96000 Hz, stereo, fltp (default)
Metadata:
title : AUDIO[AAC]
BPS-eng : 188626
DURATION-eng : 00:01:19.999000000
NUMBER_OF_FRAMES-eng: 3750
NUMBER_OF_BYTES-eng: 1886246
_STATISTICS_WRITING_APP-eng: mkvmerge v49.0.0 ('Sick Of Losing Soulmates') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2020-11-18 05:03:06
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> mp3 (mp3_mf))
Press [q] to stop, [?] for help
[mp3_mf @ 000002142f4a5fc0] MFT name: 'MP3 Encoder ACM Wrapper MFT'
[mp3_mf @ 000002142f4a5fc0] unsupported input sample rate set
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

最佳答案

您正在使用编码器 mp3_mf,它是 MediaFoundation MP3 编码器。看起来像一个挑剔、麻烦的编码器。即使您添加 -ar 48000它可能仍然失败并出现错误 nb_samples (1024) != frame_size (0) .
要修复它,请使用不同的 MP3 编码器。使用输出选项 -c:a libmp3lame (而不是 -c:a mp3_mf 如果你使用它)。

ffmpeg -i input.mkv -c:a libmp3lame output.mp3
libmp3lame 会自动选择合适的采样率,所以不需要添加 -ar .

关于python - 在 python 上使用 ffmpeg 将 mkv 转换为 mp3 时出现“不支持的输入采样率设置”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65308648/

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