fix(media): 转码按短边等比定档并回写实际尺寸
This commit is contained in:
1 parent
217ff24f1c
commit
04d25cd23d
2 files changed
+155
-7
No files matched your search
@@ -25421,3 +25421,42 @@ expected: "1:1"
|
||||
小源码片仍被放大,且未固定 SAR。横屏基础尺寸用例已通过,说明测试片生成、
|
||||
ffprobe 探测与 HLS 链路本身正常。
|
||||
|
||||
### 实现
|
||||
|
||||
- ffprobe 读取源视频 width/height;存在 90/270 度旋转元数据时按最终显示方向交换宽高。
|
||||
- 每档短边值取 `min(档位 width/height, 源显示短边)`,再向下取偶数。
|
||||
- 横屏使用 `scale=-2:<short>:flags=lanczos,setsar=1`;
|
||||
竖屏使用 `scale=<short>:-2:flags=lanczos,setsar=1`,只等比缩放。
|
||||
- 不放大策略统一为“高于源短边的档位仍保留 quality 与码率,分辨率封顶到源短边”,
|
||||
因而不会出现全部档位被跳过、无 rendition 可播的情况。
|
||||
- 每档完成后 ffprobe 读取 variant HLS 的实际 width/height,写入
|
||||
`ProducedRendition`,worker 继续原样回写 `media_rendition`;
|
||||
master playlist 的 RESOLUTION 也使用实际尺寸。
|
||||
|
||||
### 定向测试
|
||||
|
||||
```text
|
||||
$ mvn -pl fruitshorts-transcode-worker -am \
|
||||
-Dtest=FfmpegTranscodeRunnerSmokeTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
```
|
||||
|
||||
解读:横屏、竖屏、不放大、偶数尺寸、SAR=1、ffprobe 实际尺寸与
|
||||
master RESOLUTION 均通过真实 ffmpeg 验证。
|
||||
|
||||
### 最终门禁
|
||||
|
||||
```text
|
||||
$ mvn -pl fruitshorts-module-media,fruitshorts-transcode-worker test
|
||||
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] Tests run: 35, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] fruitshorts-module-media ........................... SUCCESS
|
||||
[INFO] fruitshorts-transcode-worker ....................... SUCCESS
|
||||
[INFO] BUILD SUCCESS
|
||||
```
|
||||
|
||||
解读:P2 查询测试、worker 入队/失败回写测试和新增宽高比 smoke 全部通过。
|
||||
未启停服务、未执行数据库变更、未改前端/App/specs 或 P2 接口字段。
|
||||
|
||||
Reference in new issue
Block a user