vault backup: 2023-12-25 16:58:25
This commit is contained in:
24
.obsidian/workspace.json
vendored
24
.obsidian/workspace.json
vendored
@@ -41,7 +41,7 @@
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "04. Programming/FFMPEG/AV_CODEC_FLAG_GLOBAL_HEADER.md",
|
||||
"file": "04. Programming/FFMPEG/Profiles & levels.md",
|
||||
"mode": "source",
|
||||
"source": true
|
||||
}
|
||||
@@ -114,7 +114,7 @@
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "04. Programming/FFMPEG/AV_CODEC_FLAG_GLOBAL_HEADER.md",
|
||||
"file": "04. Programming/FFMPEG/Profiles & levels.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
@@ -139,7 +139,7 @@
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "04. Programming/FFMPEG/AV_CODEC_FLAG_GLOBAL_HEADER.md"
|
||||
"file": "04. Programming/FFMPEG/Profiles & levels.md"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -167,7 +167,7 @@
|
||||
"state": {
|
||||
"type": "file-properties",
|
||||
"state": {
|
||||
"file": "04. Programming/FFMPEG/AV_CODEC_FLAG_GLOBAL_HEADER.md"
|
||||
"file": "04. Programming/FFMPEG/Profiles & levels.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,8 +212,14 @@
|
||||
},
|
||||
"active": "d5379d7d99bdf586",
|
||||
"lastOpenFiles": [
|
||||
"04. Programming/FFMPEG/FFMpeg.md",
|
||||
"04. Programming/FFMPEG/av_opt_set.md",
|
||||
"04. Programming/FFMPEG/Use av_opt_set to setup profile.md",
|
||||
"04. Programming/FFMPEG/Profiles & levels.md",
|
||||
"attachments/Pasted image 20231225164717.png",
|
||||
"attachments/Pasted image 20231225164413.png",
|
||||
"attachments/Pasted image 20231225164349.png",
|
||||
"04. Programming/FFMPEG/AV_CODEC_FLAG_GLOBAL_HEADER.md",
|
||||
"04. Programming/FFMPEG/FFMpeg.md",
|
||||
"01. 個人/01. Daily/2023-12-22(週五).md",
|
||||
"01. 個人/01. Daily/2023-12-18(週一).md",
|
||||
"04. Programming/FFMPEG/Structure.md",
|
||||
@@ -239,9 +245,6 @@
|
||||
"attachments/Pasted image 20231212180917.png",
|
||||
"05. 資料收集/libsndfile.md",
|
||||
"00. Inbox/SSIM.md",
|
||||
"00. Inbox/Brown noise.md",
|
||||
"00. Inbox/White noise.md",
|
||||
"06. Archives(歸檔)/想要的鏡頭/變焦/Fujifilm XF 16-80mm F4 R OIS WR.md",
|
||||
"未命名 1.canvas",
|
||||
"未命名.canvas",
|
||||
"01. 個人/01. Daily/2023/11",
|
||||
@@ -258,9 +261,6 @@
|
||||
"attachments/Pasted image 20230504183452.png",
|
||||
"attachments/Pasted image 20230504183439.png",
|
||||
"06. Archives(歸檔)/想要的鏡頭/變焦",
|
||||
"attachments/Pasted image 20230426214323.png",
|
||||
"attachments/Pasted image 20230426213640.png",
|
||||
"attachments/Pasted image 20230426213616.png",
|
||||
"attachments/Pasted image 20230426213611.png"
|
||||
"attachments/Pasted image 20230426214323.png"
|
||||
]
|
||||
}
|
||||
@@ -5,5 +5,3 @@
|
||||
3. **最佳化儲存:**如果你將音訊視訊資料進行存儲,使用全域頭可以減少儲存需求,因為頭資訊只需儲存一次,而不是與每個資料包一起儲存。
|
||||
|
||||
整體而言,`AV_CODEC_FLAG_GLOBAL_HEADER`的使用可以改善多媒體資料的傳輸效率和儲存效率,但在實際應用中,需要確保使用該標誌的影響不會導致相容性或其他問題。
|
||||
|
||||
|
||||
|
||||
43
04. Programming/FFMPEG/Profiles & levels.md
Normal file
43
04. Programming/FFMPEG/Profiles & levels.md
Normal file
@@ -0,0 +1,43 @@
|
||||
- [H.264 profiles and levels](https://blog.mediacoderhq.com/h264-profiles-and-levels/)
|
||||
|
||||
H.264 有四種畫質級別,分別是`baseline`, `extended`, `main`, `high`:
|
||||
|
||||
- baseline profile:基本畫質。支援I/P 幀,只支援無交錯(Progressive)和CAVLC
|
||||
- extended profile:進階畫質。支援I/P/B/SP/SI 幀,只支援無交錯(Progressive)和CAVLC;(用的少)
|
||||
- main profile:主流畫質。提供I/P/B 幀,支援無交錯(Progressive)和交錯(Interlaced),也支援CAVLC 和CABAC 的支援
|
||||
- high profile:高階畫質。在main profile 的基礎上增加了8x8 內部預測、自訂量化、無損視訊編碼和更多的YUV 格式
|
||||
|
||||
H.264 baseline profile、extended profile 和 main profile 都是針對`8位`樣本資料、4:2:0 格式(YUV) 的視訊序列。在相同配置情況下,high profile(HP)可以比main profile(MP 降低10% 的碼率)
|
||||
|
||||
- `profile`: 規定了一個演算法特徵和限制的子集,任何遵守某個profile 的解碼器都應該支援與其對應的子集,是對視訊壓縮_特性的描述_(CABAC、顏色採樣數等)
|
||||
- `level`: 規定了一組對標準中語法成員(syntax element)所採用的各種參數值的限制,對_視頻本身特性的描述_(fps (幀率)、碼率、分辨率)
|
||||
> 總的來說就是,profile 越高,表示採用了越高級的壓縮特性;level 越高,表示影片的幀率、碼率、解析度越高
|
||||
|
||||
## profile
|
||||
![[Pasted image 20231225164349.png]]
|
||||
|
||||
- Baseline Profile (BP):主要用於計算資源有限的低成本應用程序,此設定檔廣泛用於視訊會議和行動應用程式。
|
||||
- Main Profile (MP):最初打算作為廣播和儲存應用程式的主流消費者個人資料,當為這些應用程式開發High profile 時,此設定檔的重要性逐漸消失。
|
||||
- Extended Profile (XP):旨在作為串流視訊設定文件,此設定檔具有相對較高的壓縮能力和一些額外的技巧,以提高資料遺失和伺服器串流切換的穩健性。
|
||||
- High Profile (HiP):廣播和光碟儲存應用程式的主要設定文件,特別是高清電視應用程式(例如,HD DVD 和藍光光碟採用的設定檔)。
|
||||
- High 10 Profile (Hi10P): 超越當今的主流消費產品功能,此配置文件建立在High Profile 之上—— 增加了對解碼圖像精度的每個樣本高達10 位的支援。
|
||||
- High 4:2:2 Profile (Hi422P):主要針對使用隔行視頻的專業應用程序,此配置文件建立在High 10 Profile 之上—— 增加了對4:2:2 色度子採樣格式的支持,同時使用多達10 位元每個解碼影像精度的樣本。
|
||||
- High 4:4:4 Predictive Profile (Hi444PP):此設定檔建立在高4:2:2 設定檔之上- 支援高達4:4:4 色度取樣,每個取樣高達14 位,此外還支援高效率無損區域編碼並將每張圖片編碼為三個獨立的顏色平面。
|
||||
|
||||
## Level
|
||||
![[Pasted image 20231225164413.png]]
|
||||
|
||||
level 的計算方法:
|
||||
例如解析度: `1920x1080`, 60fps 的 H.264 碼流是哪個 level 呢?
|
||||
|
||||
H.264 的 marco block 大小為 `16×16` in H.264, 每frame的 marco block 的個數為**解析度除以16**。
|
||||
- `max-fs = ceil( width / 16.0 ) * ceil( height / 16.0 )`
|
||||
計算得:8100
|
||||
|
||||
每秒 marco block 數量為每幀 marco block 數乘以幀率.
|
||||
- max-mbps =max-fs * 參考幀率(60)
|
||||
計算得:486000
|
||||
|
||||
![[Pasted image 20231225164717.png]]
|
||||
|
||||
因此對比表上的數據 `1920x1080@60fps`,level 應該選擇`4.2`
|
||||
@@ -0,0 +1,7 @@
|
||||
- [Encode/H.264 – FFmpeg](https://trac.ffmpeg.org/wiki/Encode/H.264)
|
||||
|
||||
```cpp
|
||||
av_opt_set(avStream->codecContext->priv_data, "profile", "baseline", 0);
|
||||
```
|
||||
|
||||
[profile 的選項](https://trac.ffmpeg.org/wiki/Encode/H.264#Profile)
|
||||
8
04. Programming/FFMPEG/av_opt_set.md
Normal file
8
04. Programming/FFMPEG/av_opt_set.md
Normal file
@@ -0,0 +1,8 @@
|
||||
`av_opt_set()` 可以設定很多東西,例如:
|
||||
```cpp
|
||||
av_opt_set(codecContext, "preset", "ultrafaset", 0); // 速度慢,高品質
|
||||
av_opt_set(codecContext, "tune", "fastdecode", 0);
|
||||
av_opt_set(avStream->codecContext->priv_data, "profile", "baseline", 0);
|
||||
```
|
||||
|
||||
詳細請看[Encode/H.264 – FFmpeg](https://trac.ffmpeg.org/wiki/Encode/H.264)。
|
||||
BIN
attachments/Pasted image 20231225164349.png
Normal file
BIN
attachments/Pasted image 20231225164349.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 606 KiB |
BIN
attachments/Pasted image 20231225164413.png
Normal file
BIN
attachments/Pasted image 20231225164413.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 815 KiB |
BIN
attachments/Pasted image 20231225164717.png
Normal file
BIN
attachments/Pasted image 20231225164717.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 149 KiB |
Reference in New Issue
Block a user