gstreamer gst_element_seek在mpeg2ts上非常慢 [英] gstreamer gst_element_seek very slow on mpeg2ts

查看:147
本文介绍了gstreamer gst_element_seek在mpeg2ts上非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我到目前为止在玩游戏时想得到的:

Here is what I have come up with so far for seeking while playing:

case GDK_Up:
{

    gint64 pos_ns, dur_ns, seek_ns;
    GstFormat format;

    format = GST_FORMAT_TIME;

    gst_element_query_duration(pipeline,&format,&dur_ns);
    gst_element_query_position(pipeline,&format,&pos_ns);
    g_print ("Time: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (pos_ns), GST_TIME_ARGS (dur_ns));

    seek_ns = pos_ns + 60*GST_SECOND;

    if (!gst_element_seek (pipeline, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
             GST_SEEK_TYPE_SET, seek_ns,
             GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) 
    {

        g_print ("Seek failed!\n");

    }


}

break;

这是我的管道:

pipeline = gst_parse_launch("filesrc location=filename.mpg ! decodebin name=decoder decoder. ! queue ! audioconvert ! alsasink decoder. ! deinterlace ! ffmpegcolorspace ! glimagesink",&error);

执行第一次搜索大约需要3秒钟,而通过第五次或第六次搜索需要15到20秒才能从新位置开始播放.我知道我一定做错了什么,但是我无法从文档中弄清楚那是什么.

The first seek will take about 3 seconds to perform, by the 5th or 6th seek it is taking 15 to 20 seconds to start playing from the new position. I know I must be doing something wrong, but I can't figure out from the documentation what that is.

这是我构建管道的方式吗?我意识到我在这里采取了一些捷径.

Is it the way I have constructed the pipeline? I realize that I have taken some shortcuts here.

是媒体文件的类型吗? (mpeg2ts) 它是媒体文件的长度吗? (4小时)

Is it the type of media file? (mpeg2ts) Is it the length of the media file? (4 hours)

文档说:

应用程序在管道上发出一个搜索,并且在搜索调用返回后立即播放新媒体.

The application issues a seek on the pipeline and the new media is immediatly played after the seek calls returns.

那么,寻找调用返回所需的时间这么长?

So what is taking so long for the seek call to return?

任何帮助将不胜感激.

Any help would be greatly appreciated.

更新:

这是调试级别2的调试日志:

Here is the debug log from a debug level of 2:

(fullscreen02:4554): GLib-GObject-WARNING **: g_object_set_property: property `device-name' of object class `GstAlsaSink' is not writable
0:00:01.137170699  4554       0x9d9500 WARN             mpegtsdemux gstmpegtsdemux.c:754:gst_mpegts_demux_fill_stream: AC3 stream type found but no corresponding descriptor to differentiate between AC3 and EAC3. Assuming plain AC3.
0:00:01.179042694  4554       0x9d9500 WARN             mpegtsdemux gstmpegtsdemux.c:754:gst_mpegts_demux_fill_stream: AC3 stream type found but no corresponding descriptor to differentiate between AC3 and EAC3. Assuming plain AC3.
0:00:01.188213891  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
0:00:01.188464979  4554 0x7ff9d80270e0 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
No accelerated IMDCT transform found
0:00:01.211118745  4554 0x7ff9d8023c40 WARN                    alsa gstalsa.c:124:gst_alsa_detect_formats:<alsasink0> skipping non-int format
No accelerated IMDCT transform found
0:00:01.237512648  4554 0x7ff9d8023c40 WARN            audioconvert gstaudioconvert.c:832:gst_audio_convert_fixate_channels:<audioconvert0> downstream caps contain no channel layout
0:00:01.239176189  4554       0x9dabd0 WARN            audioconvert gstaudioconvert.c:832:gst_audio_convert_fixate_channels:<audioconvert0> downstream caps contain no channel layout
0:00:01.273765960  4554 0x7ff9d8023c40 WARN            audioconvert gstaudioconvert.c:832:gst_audio_convert_fixate_channels:<audioconvert0> downstream caps contain no channel layout
Got prepare-xwindow-id msg
0:00:01.326878070  4554       0x6068b0 WARN                 default xoverlay.c:354:gst_x_overlay_set_xwindow_id:<glimagesink0> Using deprecated gst_x_overlay_set_xwindow_id()
0:00:01.326931302  4554       0x6068b0 WARN                 default xoverlay.c:390:gst_x_overlay_set_window_handle:<glimagesink0> Calling deprecated set_xwindow_id() method
0:00:01.337897164  4554 0x7ff9cc002cd0 WARN                     bin gstbin.c:2380:gst_bin_do_latency_func:<pipeline0> did not really configure latency of 0:00:00.000000000
0:00:02.042181425  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
0:00:03.016673305  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
0:00:04.489319920  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
0:00:05.961069736  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
Counter: 0:00:05.930250000 / 3:37:14.178723991  (this is when a 60 sec seek forward was initiated)
0:00:07.300999850  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
0:00:07.317269896  4554 0x7ff9cc005cd0 WARN                     bin gstbin.c:2380:gst_bin_do_latency_func:<pipeline0> did not really configure latency of 0:00:00.000000000
0:00:07.641986233  4554       0x9d9500 WARN               decodebin gstdecodebin.c:1485:queue_filled_cb:<decoder> Queue is bigger than 20Mbytes, something else is going wrong
0:00:11.059481122  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
0:00:11.474393831  4554       0x9d9500 WARN               decodebin gstdecodebin.c:1485:queue_filled_cb:<decoder> Queue is bigger than 20Mbytes, something else is going wrong
previous line repeated 55 times
0:00:12.532097973  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
0:00:12.538414925  4554       0x9d9500 WARN               decodebin gstdecodebin.c:1485:queue_filled_cb:<decoder> Queue is bigger than 20Mbytes, something else is going wrong
previous line repeated 26 times
Counter: 0:02:05.745916667 / 3:37:14.178723991 (this is when a 60 sec seek forward was initiated)
0:00:13.113363951  4554 0x7ff9cc002c80 WARN                     bin gstbin.c:2380:gst_bin_do_latency_func:<pipeline0> did not really configure latency of 0:00:00.000000000
0:00:13.116343604  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
0:00:13.472504323  4554       0x9d9500 WARN               decodebin gstdecodebin.c:1485:queue_filled_cb:<decoder> Queue is bigger than 20Mbytes, something else is going wrong
previous line repeated 9 times
0:00:25.545042104  4554 0x7ff9d8023c40 WARN             mpegtsdemux gstmpegtsdemux.c:2865:gst_mpegts_demux_src_pad_query:<mpegtsdemux0> unsupported query format or no bitrate yet to approximate duration from bytes
0:00:25.580215323  4554       0x9d9500 WARN               decodebin gstdecodebin.c:1485:queue_filled_cb:<decoder> Queue is bigger than 20Mbytes, something else is going wrong
previous line repeated 43 times 

我目前正在查找其中的一些警告.

I am currently in the process of looking up some of these warnings.

推荐答案

您的管道看起来还不错. mpegts元素有很多优化.您的gstreamer安装最新信息.如果您的安装是最新的,则可以运行分析器(例如oprofile)来查看是否有热点.您还可以检查gstreamer调试日志,以查看是否有关于该文件的投诉.

Your pipeline looks okay. There have been lots of optimizations on mpegts elements. How up to date is your gstreamer installation. If your installation is up to date, you could run a profiler such as oprofile to see if there are hotspots. You can also check the gstreamer debug log to see if there are any complains regarding the file.

这篇关于gstreamer gst_element_seek在mpeg2ts上非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆