0

In My App, I have to decode the bytearray (that is in .h264 format) in to video and the byte array coming from live steaming. The code is below:

static final int VIDEO_BUF_SIZE = 100000;
static final int FRAME_INFO_SIZE = 16;
byte[] frameInfo = new byte[FRAME_INFO_SIZE];
byte[] videoBuffer = new byte[VIDEO_BUF_SIZE];

File SDFile = android.os.Environment.getExternalStorageDirectory();

File destDir = new File(SDFile.getAbsolutePath() + "/test.h264");


//avRecvFrameData returns the length of the frame and stores it in ret.
int ret = av.avRecvFrameData(avIndex, videoBuffer,
                        VIDEO_BUF_SIZE, frameInfo, FRAME_INFO_SIZE,
                        frameNumber);

fos=new FileOutputStream(destDir,true);
                fos.write(videoBuffer, 0, ret);
                fos.close();

So what can I do now?

Thanks to All.

Nathan Bird
  • 910
  • 1
  • 9
  • 23
Ajay
  • 185
  • 3
  • 18

1 Answers1

1

I have used javacv library for performing decoding of H.264 live stream. Its quite nice library. here is the my question and its answer, it may help you. If you perform similar steps as i have performed, it will decode the video and you will be able to play it on device.

Community
  • 1
  • 1
Ichigo Kurosaki
  • 3,765
  • 8
  • 41
  • 56
  • how to build ffmpeg library in android for windows 7? – Ajay Jan 24 '15 at 09:20
  • is the voice also coming? – Ajay Jan 24 '15 at 09:21
  • In live stream, the audio and video frames are different, so you need to capture the frames separately, and you should know what is the media format of audio. So accordingly you can decode the voice with correct decoder – Ichigo Kurosaki Jan 24 '15 at 09:24
  • till we are not getting any data about audio.Is the ffmpeg library is the only solution to decode the data. – Ajay Jan 24 '15 at 10:00
  • I can't guarantee about the only solution, but ffmepeg is the most widely used choice for handling video and audio conversion – Ichigo Kurosaki Jan 24 '15 at 10:09
  • hai ichigo ,did u give the documentation for this one.It will be very much helpful to me and my mail id is mohanraj.kandregula@gmail.com – Ajay Jan 24 '15 at 12:58
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/69508/discussion-between-ichigo-kurosaki-and-user3069551). – Ichigo Kurosaki Jan 24 '15 at 13:47
  • what is revivedvideopacket and videoCodecContext in ur question? – Ajay Jan 27 '15 at 08:59
  • So... @ajay, i'm with the same issue and almost identical code... seems to be using the same library.. what have you done? – FearX Mar 27 '19 at 19:45