다음 명령줄을 사용하여 파일을 인코딩하려고 합니다.
ffmpeg -i "source.mp4" -c:v libx265 -preset slow -crf 23.8 -vf scale=1920:-1:flags=lanczos -x265-params ref=6:bframes=5:no-sao=1:no-strong-intra-smoothing=1:cutree=0:aq-mode=3:deblock=-1,-1:rskip=0:rc-lookahead=80:subme=1:numa-pools=16:frame-threads=4 -c:a copy -movflags faststart output.mp4
일부 파일은 매우 다른 인코딩 설정으로 돌아옵니다. Mediainfo에서는 CRF도 잘못되었습니다. 이런 일이 발생하면 다음과 같은 경고가 표시됩니다.
[mp4 @ 00000148a5247040] track 1: codec frame size is not set
나는 이것을 구글링했는데 아무도 이 경고가 문제를 일으키는 것으로 언급하지 않는 것 같습니다.
나는 꽤 최근의 빌드를 사용하고 있습니다: ffmpeg version 2021-10-03-git-2761a7403b-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
gcc 10.3.0(Rev5, MSYS2 프로젝트에 의해 구축됨)으로 구축되었습니다.
SOURCE MEDIAINFO:
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 32 min 43 s
Bit rate : 20.5 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.099
Stream size : 4.69 GiB (100%)
Writing library : x264 core 157 r2969 d4099dd
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=50 / keyint_min=5 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=25.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language : English
Codec configuration box : avcC
X265 OUTPUT MEDIAINFO:
Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main@L4@Main
Codec ID : hev1
Codec ID/Info : High Efficiency Video Coding
Duration : 32 min 43 s
Bit rate : 5 186 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0 (Type 0)
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.100
Stream size : 1.19 GiB (100%)
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=50 / keyint_min=5 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=25.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language : English
Color range : Limited
Codec configuration box : hvcC
출력 인코딩 설정이 내 인코더 설정이 아닌 소스와 일치하는 것 같습니다. 일부 파일은 정확히 동일한 설정으로 인코딩이 잘 되지만 "코덱 프레임 크기가 설정되지 않았습니다"라는 경고 메시지가 표시되지 않습니다. 나는 꽤 여러 번 설정을 변경했으며 문제 파일에 대해서도 동일한 결과를 얻었습니다. 한 번만 발생했다면 소스에 문제가 있다고 생각하겠지만 제가 인코딩한 마지막 4개 파일 중 2개에 문제가 발생한 것이므로 뭔가 누락된 것이 틀림없습니다. 출력에 잘못된 메타데이터가 있을 수도 있지만 확실하지는 않습니다. Handbrake에서는 이런 일이 발생하지 않습니다. 동일한 문제인 FFMPEG의 다른 빌드를 시도했습니다.