我在使用 ffmpeg 缩放器时遇到了一些问题。我通过 sdp 接收 VP9 视频流,然后转码为 H264。主流(输入)可以动态更改分辨率,但输出不能。我想根据输入分辨率/动态更改输出分辨率。
[graph 0 input from stream 0:1 @ 0x563b9c008cc0] Setting 'video_size' to value '240x320'
[graph 0 input from stream 0:1 @ 0x563b9c008cc0] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:1 @ 0x563b9c008cc0] Setting 'time_base' to value '1/90000'
[graph 0 input from stream 0:1 @ 0x563b9c008cc0] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:1 @ 0x563b9c008cc0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:1 @ 0x563b9c008cc0] Setting 'frame_rate' to value '90000/1'
[graph 0 input from stream 0:1 @ 0x563b9c008cc0] w:240 h:320 pixfmt:yuv420p tb:1/90000 fr:90000/1 sar:0/1 sws_param:flags=2
[scaler_out_0_0 @ 0x563b9c009800] Setting 'w' to value '480'
[scaler_out_0_0 @ 0x563b9c009800] Setting 'h' to value '640'
[scaler_out_0_0 @ 0x563b9c009800] Setting 'flags' to value 'bicubic'
[scaler_out_0_0 @ 0x563b9c009800] w:480 h:640 flags:'bicubic' interl:0
[format @ 0x563b9c085240] Setting 'pix_fmts' to value 'yuv420p'
[AVFilterGraph @ 0x563b9c060fc0] query_formats: 5 queried, 4 merged, 0 already done, 0 delayed
[scaler_out_0_0 @ 0x563b9c009800] w:240 h:320 fmt:yuv420p sar:0/1 -> w:480 h:640 fmt:yuv420p sar:0/1 flags:0x4
如您所见,缩放器将宽度和高度设置为启动的主流分辨率值 (480x640)。我如何“禁用”缩放器或将其设置为从输入流设置宽度和高度并在运行时遵守它?
ffmpeg -protocol_whitelist file,crypto,udp,rtp -i test.sdp -vsync 2 -an -c:v libx264 -crf 22 -preset ultrafast -tune zerolatency -thread_type slice -profile:v baseline -threads 16 -bufsize 80M -f rtp rtp://232.3.4.5:7588