为什么用合并流将两个视频文件合并在一起后,视频清晰度会下降,而且只有被合并视频的第一个?下面是我的代码
import java.io.*;
class SequenceInputStreamDemo
{
private InputStream r;
SequenceInputStreamDemo(InputStream r)
{
this.r=r;
}
//定义计数器
int count=0;
//定义指针
int pos=0;
//定义缓存区
byte[] by=new byte[1024*5];
public int myRead() throws IOException
{
if(count==0)
{
count=r.read(by);
if(count<0)
return -1;
pos=0;
byte b=by[pos];
pos++;
count--;
return b&255;
}
else if(count>0)
{
byte b=by[pos];
pos++;
count--;
return b&255;
}
return -1;
}
public void myClose() throws IOException
{
r.close();
}
}
class SequenceInputStreamDemoText
{
public static void main(String args[]) throws IOException
{
FileInputStream fis=new FileInputStream("E:\\孔令程\\5.3gp");
FileInputStream fiss=new FileInputStream("E:\\孔令程\\6.3gp");
FileOutputStream fos=new FileOutputStream("E:\\孔令程\\56.3gp");
BufferedOutputStream bos=new BufferedOutputStream(fos);
SequenceInputStream sis=new SequenceInputStream(fis,fiss);
SequenceInputStreamDemo sisd=new SequenceInputStreamDemo(sis);
int num=0;
while((num=sisd.myRead())!=-1)
{
bos.write(num);
}
bos.close();
sis.close();
}
}
|
|