출력 된 스트림에 인코딩 된 버퍼링 된 이미지를 쓰려고하는데 스트림에 오는 모든 데이터를 가져올 수 없습니다 ... 누군가가 내가 뭘 잘못하고 왜 내가 할 수 없는지 말할 수 있습니까? 출력을 볼 수 있습니까?xuggler를 사용하여 outputStream에 쓰는 방법은 무엇입니까?
필자는 write.encodeVideo 메서드를 호출하여 비디오를 ByteArrayOutputStream으로 인코딩한다고 가정 할 것입니다.
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// video parameters
final int videoStreamIndex = 0;
final int videoStreamId = 0;
final long frameRate = DEFAULT_TIME_UNIT.convert(15, MILLISECONDS);
final int width = 512;
final int height = 254;
long nextFrameTime = 0;
// create a media writer and specify the output file
final IMediaWriter writer = ToolFactory.makeWriter("aaa.ogg");
IContainer ic = writer.getContainer();
ic.open(outputStream, writer.getContainer().getContainerFormat(), true, false);
ICodec codec = ICodec.guessEncodingCodec(null, null,"aaa.ogg", null, ICodec.Type.CODEC_TYPE_VIDEO);
// add the video stream
writer.addVideoStream(videoStreamIndex, videoStreamId, codec, width, height);
BufferedImage img = null;
try
{
img = ImageIO.read(new File("/home/jbkreme/aaa.png"));
}
catch (final IOException e)
{
e.printStackTrace();
}
for(int yy =0; yy < 2048-height; yy=yy+8)
{
nextFrameTime++;
BufferedImage frame = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
frame = img.getSubimage(0, yy, width, height);
BufferedImage frame2 = convertToType(frame, BufferedImage.TYPE_3BYTE_BGR);
//encode the video
writer.encodeVideo(videoStreamIndex, frame2, nextFrameTime, DEFAULT_TIME_UNIT);
nextFrameTime += frameRate;
}
writer.close();
outputStream.flush();
outputStream.close();
대답을 알아 냈습니까? –
내가 그랬다고 생각하지 않습니까? 죄송합니다 – Grammin
@PhaniRahul 당신은 여전히 OutputStream 인코딩하려는 경우 대답을 제출했습니다. – 11101101b