从 flac 转换为 alac 时,ffmpeg 仅以位深度 s32p 输出

从 flac 转换为 alac 时,ffmpeg 仅以位深度 s32p 输出

我正在尝试使用ffmpeg.对于我的环境(Apple 和 Sonos),最小公分母似乎如下:

ALAC (.m4a) 编码频率为 44.1kHz,位深度 = 16 位

我遇到的问题是生成的输出文件ffmpeg有一个‘32p’的位深度; IE sample_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%

答案1

这在这里有效。

ffmpeg -i in -c:a alac -ar 44100 -sample_fmt s16p -c:v png -vsync 0 out.m4a

请注意,ALAC 编码器检查原始帧是否为 16 位平面的

相关内容