首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用gst-launch (gstreamer)将.mp4文件转换为不缺帧的.yuv (原始视频i420)?

如何使用gst-launch (gstreamer)将.mp4文件转换为不缺帧的.yuv (原始视频i420)?
EN

Stack Overflow用户
提问于 2020-09-04 04:36:07
回答 1查看 1.1K关注 0票数 0

我在gstreamer截断gst-launch管道的yuv输出时遇到了问题。简化的例子是

代码语言:javascript
复制
gst-launch-1.0 filesrc location="$input" \
               ! decodebin \
               ! 'video/x-raw, format=I420' \
               ! rawvideoparse \
               ! filesink location="$output" buffer-mode=2

当我在一个包含7680x3840大小为600帧的H.264视频的MP4文件上运行它时,它给出了一个6280934400字节长的文件。快速算术6280934400 / 7680 / 3840 / 600 = 0.3549609375这是略高于三分之一字节的每像素。

代码语言:javascript
复制
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%的工作?

EN

回答 1

Stack Overflow用户

发布于 2020-09-04 22:17:35

我认为:

代码语言:javascript
复制
gst-launch-1.0 filesrc location="$input" \
               ! decodebin \
               ! filesink location="$output"

应该足够了。因为解码器应该默认输出I420 (除非它是一个特殊的配置文件)。之后不需要解析数据(实际上这可能是问题的根源,因为该元素的内部宽度和高度属性被设置为320x240)。你只想把来自解码器的东西转储到磁盘上。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63731285

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档