вопросов 2
1) почему ffmpeg, mediainfo, mkvinfo показывают разные видео/аудио-битрейты?
2) почему видео/аудио-битрейты после конвертации отличаются от указанных в команде?
сразу напишу, что постигать все тонкости кодирования мне не к чему, но вот этот момент уже давно хочу прояснить (возможно, нужно поспрашивать на спец-форумах, но уверен, что и здесь найдутся знающие люди)
есть mkv, нужно:
- изменить разрешение с 720p на 576p
- указать при этом видео-битрейт исходного видео
- перекодировать аудио из AC3 (5.1) в Vorbis (2.0)
- все остальное как и в оригинале
вывод ffmpeg:
~$ ffmpeg -i original.mkv
Input #0, matroska,webm, from 'original.mkv':
Metadata:
encoder : libebml v1.3.0 + libmatroska v1.4.1
creation_time : 2014-05-10T08:41:32.000000Z
Duration: 01:38:49.95, start: 0.000000, bitrate: 2520 kb/s
Stream #0:0(jpn): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
Metadata:
title : JP Sound
Stream #0:1(jpn): Video: h264 (High 10), yuv420p10le(progressive), 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Metadata:
title : Sakasama no Patema
At least one output file must be specified
ffmpeg показывает аудио-битрейт (640 kb/s), но не показывает видео-битрейт
вывод mediainfo:
~$ mediainfo original.mkv
General
Unique ID : 224998964268559879765984845306211098374 (0xA945396A06E825D3B0C4389397A05F06)
Complete name : original.mkv
Format : Matroska
Format version : Version 4 / Version 2
File size : 1.74 GiB
Duration : 1 h 38 min
Overall bit rate : 2 521 kb/s
Encoded date : UTC 2014-05-10 08:41:32
Writing application : mkvmerge v6.7.0 ('Back to the Ground') 64bit built on Jan 8 2014 15:10:52
Writing library : libebml v1.3.0 + libmatroska v1.4.1
Video
ID : 2
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 10@L5
Format settings : CABAC / 16 Ref Frames
Format settings, CABAC : Yes
Format settings, ReFrames : 16 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1 h 38 min
Bit rate : 1 830 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 10 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.083
Stream size : 1.26 GiB (73%)
Title : Sakasama no Patema
Writing library : x264 core 138 r2358 9e941d1
Encoding settings : cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 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=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.60 / qpmin=0 / qpmax=81 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language : Japanese
Default : Yes
Forced : No
Audio
ID : 1
Format : AC-3
Format/Info : Audio Coding 3
Codec ID : A_AC3
Duration : 1 h 38 min
Bit rate mode : Constant
Bit rate : 640 kb/s
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 SPF)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 452 MiB (25%)
Title : JP Sound
Language : Japanese
Service kind : Complete Main
Default : Yes
Forced : No
mediainfo показывает аудио-битрейт (640 kb/s) и видео-битрейт (1830 kb/s)
вывод mkvinfo:
~$ mkvinfo -v -t original.mkv | grep Statistics
Statistics for track number 1: number of blocks: 185311; size in bytes: 474396160; duration in seconds: 5929.95; approximate bitrate in bits/second: 640000
Statistics for track number 2: number of blocks: 142176; size in bytes: 1392703392; duration in seconds: 5929.92; approximate bitrate in bits/second: 1878882
аудио-битрейт точно такой же, как и у ffmpeg/mediainfo (640 kb/s), но видео-битрейт отличается (~1878 kb/s)
так какой видео-битрейт верный? 1830 kb/s или 1878 kb/s ? я так понимаю, что mediainfo просто показывает видео-битрейт, изначально указанный при конвертации; а mkvinfo его как-то по-своему вычисляет, поэтому его и указываю в команде
конвертация:
~$ export LD_PRELOAD=/usr/lib/i386-linux-gnu/x264-10bit/libx264.so.150 && ffmpeg -i original.mkv -c:v libx264 -profile:v high10 -level 50 -b:v 1878k -color_primaries bt709 -color_trc bt709 -colorspace bt709 -pix_fmt yuv420p10le -r 23.976 -s 1024x576 -c:a libvorbis -ar 48000 -ac 2 -ab 256k -map_metadata 0 converted.mkv
profile и level как и в исходном видео:
~$ ffprobe -v error -select_streams v:0 -show_entries stream=profile,level -of default=noprint_wrappers=1 original.mkv
profile=High 10
level=50
вывод ffmpeg:
~$ ffmpeg -i converted.mkv
Input #0, matroska,webm, from 'converted.mkv':
Metadata:
creation_time : 2014-05-10T08:41:32.000000Z
ENCODER : Lavf57.71.100
Duration: 01:38:49.96, start: 0.000000, bitrate: 2088 kb/s
Stream #0:0(jpn): Video: h264 (High 10), yuv420p10le(tv, bt709, progressive), 1024x576 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Metadata:
title : Sakasama no Patema
ENCODER : Lavc57.89.100 libx264
DURATION : 01:38:49.933000000
Stream #0:1(jpn): Audio: vorbis, 48000 Hz, stereo, fltp (default)
Metadata:
title : JP Sound
ENCODER : Lavc57.89.100 libvorbis
DURATION : 01:38:49.955000000
At least one output file must be specified
вывод mediainfo:
~$ mediainfo converted.mkv
General
Unique ID : 326605433124001026756211243304021524494 (0xF5B5EB19FD2215A098D9B5F3A1F2000E)
Complete name : converted.mkv
Format : Matroska
Format version : Version 4 / Version 2
File size : 1.44 GiB
Duration : 1 h 38 min
Overall bit rate mode : Variable
Overall bit rate : 2 089 kb/s
Encoded date : UTC 2014-05-10 08:41:32
Writing application : Lavf57.71.100
Writing library : Lavf57.71.100
ErrorDetectionType : Per level 1
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 10@L5
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1 h 38 min
Bit rate : 1 878 kb/s
Width : 1 024 pixels
Height : 576 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (23976/1000) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 10 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.133
Stream size : 1.24 GiB (86%)
Title : Sakasama no Patema
Writing library : x264 core 150
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=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=1878 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=81 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language : Japanese
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
ID : 2
Format : Vorbis
Format settings, Floor : 1
Codec ID : A_VORBIS
Duration : 1 h 38 min
Bit rate mode : Variable
Bit rate : 256 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Compression mode : Lossy
Stream size : 181 MiB (12%)
Title : JP Sound
Writing application : Lavc57.89.100
Writing library : libVorbis (⛄⛄⛄⛄) (20150105 (⛄⛄⛄⛄))
Language : Japanese
Default : Yes
Forced : No
видио-битрейт (1878 kb/s) и аудио-битрейт (256 kb/s) соответствуют указанным в команде
вывод mkvinfo:
~$ mkvinfo -v -t converted.mkv | grep Statistics
Statistics for track number 1: number of blocks: 142176; size in bytes: 1384956791; duration in seconds: 5929.93; approximate bitrate in bits/second: 1868428
Statistics for track number 2: number of blocks: 444079; size in bytes: 159176145; duration in seconds: 5929.94; approximate bitrate in bits/second: 214742
почему mkvinfo в результате показывает другие битрейты? ~1868 kb/s и ~214 kb/s вместо указанных в команде 1878 kb/s и 256 kb/s
и еще меня интересуют вот эти значения:
в исходном видео:
Format settings : CABAC / 16 Ref Frames
Format settings, CABAC : Yes
Format settings, ReFrames : 16 frames
Encoding settings : cabac=1 / ref=16 / deblock=1:0:0 /
в результате:
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 /
что это такое? и как они указываются при конвертации?
спасибо