首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用libstreaming获取正在发布的流的缩略图

使用libstreaming获取正在发布的流的缩略图
EN

Stack Overflow用户
提问于 2014-06-20 17:23:58
回答 2查看 1.2K关注 0票数 1

大家好,我在我的项目中使用libstreaming,它对于从android设备发布流到Wowza服务器非常有效,现在的问题是我需要获得发布到服务器的流的缩略图。为此,我想我需要获取正在发布的流的第一帧,但是我该如何做呢?提到的here示例没有显示与此相关的任何内容。在这方面如有任何帮助,我们将非常感谢……

EN

回答 2

Stack Overflow用户

发布于 2014-09-02 14:43:30

@khurramengr,有两种方式: 1)您可以在wowza中编写一个自定义模块来录制直播流,然后使用FFMPEG命令对文件进行快照。参考:http://www.wowza.com/forums/showthread.php?577-Custom-module-to-create-single-frame-snapshots-of-live-and-VOD-stream

2)在Wowza媒体引擎-> live中开启录制选项。因此自动记录在content文件夹下的每个流。您可以使用FFMPEG为content文件夹中可用录制的mp4生成缩略图。

我试过了,两者都在工作,如果有疑问,请告诉我。

~Manikandan

票数 1
EN

Stack Overflow用户

发布于 2016-09-28 23:31:03

现在已经很晚了,但我希望能帮助其他晚来的人。我认为解决方案是使用Wowza代码转换器:https://www.wowza.com/forums/content.php?307-How-to-get-thumbnail-images-from-Wowza-Transcoder-with-an-HTTP-Provider看看function onGrabFrame(TranscoderNativeVideoFrame videoFrame),如下所示:

代码语言:javascript
复制
public void onGrabFrame(TranscoderNativeVideoFrame videoFrame)
    {           
        BufferedImage image = TranscoderStreamUtils.nativeImageToBufferedImage(videoFrame);
        if (image != null)
        {

            getLogger().info("ModuleTestTranscoderFrameGrab#GrabResult.onGrabFrame: "+image.getWidth()+"x"+image.getHeight());

            String storageDir = appInstance.getStreamStoragePath();

            File pngFile = new File(storageDir+"/thumbnail.png");
            File jpgFile = new File(storageDir+"/thumbnail.jpg");

            try
            {
                if (pngFile.exists())
                    pngFile.delete();
                ImageIO.write(image, "png", pngFile);
                getLogger().info("ModuleTestTranscoderFrameGrab#GrabResult.onGrabFrame: Save image: "+pngFile);
            }
            catch(Exception e)
            {
                getLogger().error("ModuleTestTranscoderFrameGrab.grabFrame: File write error: "+pngFile);
            }

            try
            {
                if (jpgFile.exists())
                    jpgFile.delete();
                ImageIO.write(image, "jpg", jpgFile);
                getLogger().info("ModuleTestTranscoderFrameGrab#GrabResult.onGrabFrame: Save image: "+jpgFile);
            }
            catch(Exception e)
            {
                getLogger().error("ModuleTestTranscoderFrameGrab.grabFrame: File write error: "+jpgFile);
            }
        }
    }

致以敬意,

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

https://stackoverflow.com/questions/24323998

复制
相关文章

相似问题

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