gpt4 book ai didi

linux - GStreamer 帧率为10/1时,视频播放速度变快

转载 作者:太空宇宙 更新时间:2023-11-04 10:11:48 24 4
gpt4 key购买 nike

我想在以下环境中使用 GStreamer 保存视频。

Hardware: Raspberry pi (BCM 2709 Revision: a 22082)

OS: Raspbian GNU / Linux 9 (stretch)Webcam: Logitech HD WEBCAM C270

使用以下命令保存的视频,播放速度变得比预期的要快。

$ gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480,format=YV12,framerate=10/1 ! videoconvert ! omxh264enc ! video/x-h264 ! h264parse ! filesink location=video.h264

但是,如果我将“帧率”更改为 30/1,我可以毫无问题地观看

我用下面的命令检查了视频的帧率

$ ffmpeg -i video.h 264

Input # 0, h 264, from 'video. H 264':
Duration: N / A, bitrate: N / A
Stream # 0: 0: Video: h 264 (High), yuv 420 p (progressive), 640 x 480 [SAR 1: 1 DAR 4: 3], 25 fps, 25 tbr, 1200 k tbn, 50 tbc

帧率为 25/1。

我尝试使用以下命令为硬件指定帧速率。

$ v4l2-ctl -d / dev / video0 -p 10

Frame rate set to 10.000 fps

但是没有效果。

我也试过使用“videorate”插件。

$ gst-launch-1.0 v4l2src ! videorate ! video/x-raw,width=640,height=480,format=YV12,framerate=10/1 ! videoconvert ! omxh264enc ! video/x-h264 ! h264parse ! filesink location=video.h264

但结果更糟。即使开始播放,视频也会保持停止状态,过一会再高速播放

GStreamer 的版本是1.10.4。这是 apt-get 唯一可用的版本。我尝试从源代码编译,但不支持在 Raspbian 上构建,这非常困难。

更新:我尝试了 Lad 的建议(谢谢!)

但显示以下错误消息...

gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480,format=YV12,framerate=10/1 ! videoconvert ! omxh264enc ! video/x-h264 ! h264parse ! mp4mux ! filesink location=video.h264

...
ERROR: from element /GstPipeline:pipeline0/GstMP4Mux:mp4mux0: Could not multiplex stream.
Additional debug info:
gstqtmux.c(3391): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstMP4Mux:mp4mux0:
Buffer has no PTS.

怎么了?

最佳答案

您在管道中缺少 mp4mux 元素。尝试以下管道:

$ gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480,format=YV12,framerate=10/1 ! videoconvert ! omxh264enc ! video/x-h264 ! h264parse ! mp4mux ! filesink location=video.h264

关于linux - GStreamer 帧率为10/1时,视频播放速度变快,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48621386/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com