Audio
從 flac 轉換為 alac 時,ffmpeg 僅以位深度 s32p 輸出
我正在嘗試使用
ffmpeg
. 對於我的環境(Apple & Sonos),最低公分母似乎如下:44.1kHz 的 ALAC (.m4a) 編碼,& 位深度 = 16 位
我遇到的問題是生成的輸出文件
ffmpeg
的位深度為 ‘32p’;IEsample_fmt=s32p
我已經用幾組參數完成了轉換,但結果是一樣的。我一直找不到任何可以解釋為什麼會這樣的東西。這是我嘗試過的命令之一:
$ file='01 Jubilee.flac' $ ffmpeg -i "$file" -acodec alac -ar 44100 -sample_fmt:0 s16 -c:v png "${file/%.flac/.16.m4a}"
我
ffprobe
在輸入文件上執行以確定其格式:$ ffprobe -i "$file" -show_streams
其中(總而言之)產生:
Stream #0:0: Audio: flac, 176400 Hz, stereo, s32 (24 bit) Stream #0:1: Video: mjpeg (Progressive), yuvj444p(pc, bt470bg/unknown/unknown), 450x446 [SAR 72:72 DAR 225:223], 90k tbr, 90k tbn, 90k tbc (attached pic)
…並在輸出文件上:
$ ffprobe -i "${file/%.flac/.16.m4a}" -show_streams
其中(總而言之)產生:
Stream #0:0(und): Audio: alac (alac / 0x63616C61), 44100 Hz, stereo, s32p (24 bit), 1564 kb/s (default) Metadata: handler_name : SoundHandler Stream #0:1: Video: png, rgb24(pc), 450x446 [SAR 1:1 DAR 225:223], 90k tbr, 90k tbn, 90k tbc (attached pic) [STREAM] index=0 codec_name=alac codec_long_name=ALAC (Apple Lossless Audio Codec) profile=unknown codec_type=audio codec_time_base=1/44100 codec_tag_string=alac codec_tag=0x63616c61 sample_fmt=s32p sample_rate=44100 ... etc, etc
我只發布了一小部分
ffprobe
輸出,但如果需要,可以提供所有內容。另外,我的ffmpeg
版本:$ ffmpeg -version ffmpeg version git-2020-01-13-7225479 Copyright (c) 2000-2020 the FFmpeg developers built with Apple clang version 11.0.0 (clang-1100.0.33.8)
最後,這是
ffmpeg
上面轉換的輸出:$ ffmpeg -v info -hide_banner -i "$file" -acodec alac -ar 44100 -sample_fmt:0 s16 -c:v png "${file/%.flac/.16.m4a}" Input #0, flac, from '01 Jubilee.flac': Metadata: track : 1 TITLE : Jubilee ARTIST : Bill Charlap Trio album_artist : Bill Charlap Trio ALBUM : Stardust The Music Of Hoagy Carmichael DATE : 2003 GENRE : Jazz TRACKTOTAL : 11 disc : 1 DISCTOTAL : 1 ALBUM ARTIST : Bill Charlap Trio Duration: 00:02:23.17, start: 0.000000, bitrate: 6176 kb/s Stream #0:0: Audio: flac, 176400 Hz, stereo, s32 (24 bit) Stream #0:1: Video: mjpeg (Progressive), yuvj444p(pc, bt470bg/unknown/unknown), 450x446 [SAR 72:72 DAR 225:223], 90k tbr, 90k tbn, 90k tbc (attached pic) Metadata: comment : Cover (front) File '01 Jubilee.16.m4a' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:1 -> #0:0 (mjpeg (native) -> png (native)) Stream #0:0 -> #0:1 (flac (native) -> alac (native)) Press [q] to stop, [?] for help [swscaler @ 0x10dc6b000] deprecated pixel format used, make sure you did set range correctly [ipod @ 0x7fc3a1002200] Frame rate very high for a muxer not efficiently supporting it. Please consider specifying a lower framerate, a different muxer or -vsync 2 Output #0, ipod, to '01 Jubilee.16.m4a': Metadata: track : 1 TITLE : Jubilee ARTIST : Bill Charlap Trio album_artist : Bill Charlap Trio ALBUM : Stardust The Music Of Hoagy Carmichael DATE : 2003 GENRE : Jazz TRACKTOTAL : 11 disc : 1 DISCTOTAL : 1 ALBUM ARTIST : Bill Charlap Trio encoder : Lavf58.35.102 Stream #0:0: Video: png, rgb24(progressive), 450x446 [SAR 1:1 DAR 225:223], q=2-31, 200 kb/s, 90k fps, 90k tbn, 90k tbc (attached pic) Metadata: comment : Cover (front) encoder : Lavc58.65.103 png Stream #0:1: Audio: alac (alac / 0x63616C61), 44100 Hz, stereo, s32p (24 bit), 128 kb/s Metadata: encoder : Lavc58.65.103 alac frame= 1 fps=0.8 q=-0.0 Lsize= 27745kB time=00:02:23.22 bitrate=1587.0kbits/s speed= 113x video:396kB audio:27342kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.026342%
這在這裡有效。
ffmpeg -i in -c:a alac -ar 44100 -sample_fmt s16p -c:v png -vsync 0 out.m4a
請注意,ALAC 編碼器檢查原始幀是否為 16 位平面