【发布时间】:2020-09-04 22:17:35
【问题描述】:
gstreamer 截断 gst-launch 管道的 yuv 输出时遇到问题。简化的例子是
gst-launch-1.0 filesrc location="$input" \
! decodebin \
! 'video/x-raw, format=I420' \
! rawvideoparse \
! filesink location="$output" buffer-mode=2
当我在 7680x3840 的 H.264 视频的 MP4 文件上运行 600 帧时,它给了我一个 6280934400 字节长的文件。快速算术 6280934400 / 7680 / 3840 / 600 = 0.3549609375 。也就是每像素三分之一多一点。
Setting pipeline to PAUSED ...
0:00:00.354592385 16438 0x555e06766b30 WARN basesrc gstbasesrc.c:3600:gst_base_src_start_complete:<filesrc0> pad not activated yet
Pipeline is PREROLLING ...
0:00:00.536788393 16438 0x7f3f90073680 WARN qtdemux qtdemux_types.c:239:qtdemux_type_get: unknown QuickTime node type uuid
0:00:00.536830878 16438 0x7f3f90073680 WARN qtdemux qtdemux.c:3237:qtdemux_parse_trex:<qtdemux0> failed to find fragment defaults for stream 1
0:00:00.536861715 16438 0x7f3f90073680 WARN qtdemux qtdemux.c:3237:qtdemux_parse_trex:<qtdemux0> failed to find fragment defaults for stream 2
Redistribute latency...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:01:11.471563917 16438 0x7f3f8000d4a0 WARN libav gstavauddec.c:628:gst_ffmpegauddec_drain:<avdec_aac0> send packet failed, could not drain decoder
Got EOS from element "pipeline0".
Execution ended after 0:01:10.085660675
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
我希望每个像素有 1.5 个字节(因为 format=I420)。
如果我改为运行ffmpeg -i $input -c:v rawvideo -pix_fmt yuv420p $output,那么我会得到 26542080000 字节,即 7680 * 3840 * 600 * 1.5,正如预期的那样。
我的目标管道比这个复杂得多(使用 GLSL 进行投影重映射),但我希望如果有人能修复这个简单的例子,它也能修复我的真实管道。
如何构建一个 gst-launch 管道,将文件正确转换为原始视频,而不会默默地放弃 20% 的工作?
【问题讨论】: