简体   繁体   English

Xuggler-Java-如何从字节数组创建数据包?

[英]Xuggler-Java- How to create packets from a byte array?

I am building an export application using Xuggler that exports a h264 encoded recording so that it can be played in an external player ( writing the video recording to.avi or.mp4 container).我正在使用 Xuggler 构建一个导出应用程序,该应用程序导出 h264 编码的录制文件,以便可以在外部播放器中播放(将视频录制文件写入 .avi 或 .mp4 容器)。

I am interested to know how one could create a IPacket from a byte array representing a video frame.我很想知道如何从表示视频帧的字节数组创建 IPacket。 What parameters from the IPacket need to be set and what values should those contain?需要设置 IPacket 中的哪些参数以及这些参数应包含哪些值? And again what parameters should be set and what should be their values for the container that gathers the packets?再一次,应该设置哪些参数以及收集数据包的容器的值应该是什么?

packet = IPacket.make( IBuffer.make( null, data, 0, data.length ));
packet.setTimeStamp( time );
packet.setTimeBase( IRational.make(1,1000) ); 
int pksz = packet.getSize(); 
packet.setComplete(true, pksz);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM