我正在嘗試決議 MP4 檔案中的 avcC 框中的 SPS。出于某種原因,我沒有得到預期的時序值,而其他一切都很好。使用十六進制編輯器,我提取了這些位元組以供使用。
byte[] spsSmall =
{
0x67, 0x42, 0xC0, 0x1E, 0x9E, 0x21, 0x81, 0x18, 0x53, 0x4D, 0x40, 0x40,
0x40, 0x50, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x03, 0xC8,
0xF1, 0x62, 0xEE
};
這是將我的剪輯 .mp4 轉換為 .h264 后的 H264 Analyzer 報告
Nal length 29 start code 4 bytes
ref 3 type 7 Sequence parameter set
profile: 66
constaint_set0_flag: 1
constaint_set1_flag: 1
constaint_set2_flag: 0
constaint_set3_flag: 0
level_idc: 30
seq parameter set id: 0
log2_max_frame_num_minus4: 6
pic_order_cnt_type: 0
log2_max_pic_order_cnt_lsb_minus4: 7
num_ref_frames: 2
gaps_in_frame_num_value_allowed_flag: 0
pic_width_in_mbs_minus1: 34 (560)
pic_height_in_map_minus1: 19
frame_mbs_only_flag: 1
derived height: 320
direct_8x8_inference_flag: 1
frame_cropping_flag: 0
vui_parameters_present_flag: 1
aspect_ratio_info_present_flag: 0
overscan_info_present_flag: 0
video_signal_info_present_flag: 1
video_format: 5
video_full_range_flag: 0
colour_description_present_flag: 1
colour_primaries: 1
transfer_characteristics: 1
matrix_coefficients: 1
chroma_loc_info_present_flag: 0
timing_info_present_flag: 1
num_units_in_tick: 1
time_scale: 60
fixed_frame_scale: 1
nal_hrd_parameters_present_flag: 0
vcl_hrd_parameters_present_flag: 0
pic_struct_present_flag: 0
motion_vectors_over_pic_boundaries_flag: 1
max_bytes_per_pic_denom: 0
max_bits_per_mb_denom: 0
log2_max_mv_length_horizontal: 10
log2_max_mv_length_vertical: 10
num_reorder_frames: 0
max_dec_frame_buffering: 2
所以我應該期望 num_units_in_tick 為 1,time_scale 為 60,但由于某種原因,我得到 num_units_in_tick 為 48 和 time_scale 為 16777216。
你可以在這里找到我的實作
我檢查了 FFmpeg 和其他實作,看看我是否遺漏了什么,但他們似乎和我做同樣的事情。我嘗試了其他剪輯,但除了時間資訊之外,我仍然擁有一切正確的東西。該檔案似乎沒有提供比我已經知道的更多的資訊。不僅如此,在計時資訊之前,我的 colour_primaries、transfer_characteristics、matrix_coefficients 都等于 1。如果我太遠或太早,我會弄錯值。我得到這個精確序列的 24 位的機會非常低。所以我迷失了我應該做什么。
我發現這篇文章說
如果您使用的是基于場的視頻,那么這將是場頻,因此您必須將其減半才能獲得幀頻。
不確定是什么意思。即使我將位數減半(32 ? 16)或除以 2,我也沒有得到接近這個的結果。
uj5u.com熱心網友回復:
您應該從 NAL 中洗掉 emulation_prevention_three_byte ,即您應該搜索 0x00、0x00、0x03 位元組對齊的序列并從那里洗掉 0x03。這樣得到的未轉義的 spsSmall 將是:
byte[] spsSmall =
{
0x67, 0x42, 0xC0, 0x1E, 0x9E, 0x21, 0x81, 0x18, 0x53, 0x4D, 0x40, 0x40,
0x40, 0x50, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x03, 0xC8, 0xF1, 0x62,
0xEE
};
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/497297.html
上一篇:AndroidJetpackCompose在LazyRow中定位子項
下一篇:不是一開始就基于模式決議
