7

I am new to video codecs and learning video file format specifications. I have read about QUICKTIME file format specifications from here, and MP4 file format (which is almost similar) from here. There are atoms such FTYPE, MOOV, MDAT etc. The MDAT atom contains actual audio and video data. The MOOV atom contains information about how to extract data from MDAT, it gives references to chunks (samples).

I want to extract the video samples in MDAT atom from video file without using any tool such ffmpeg, or juggler etc. I can write my own code for this. The problem is, even if I can locate the video data (samples) in MDAT by using information from MOOV, these samples are compressed. And we need to uncompress these to get frames. My question is can we uncompress the samples extracted from MDAT and get the actual video frames ?

Tools such as xuggler, ffmpeg etc are used to extract frames from video files. But here I want to extract the samples(for video data) from MDAT by writing my own code, but then I want to uncompress those by using some tool. I don't want to write codecs.

Can anyone please help me with this....!

Thanks...

  • To uncompress a coded frame, you need a **de**coder. codec stands for *(en)coder-decoder*, so yes, you do need a codec, either an existing one or your own. – Gyan Apr 20 '16 at 04:53
  • @Mulvya you are right, I need a decoder. I want to use existing decoders. But the point is, I want to extract samples of video data from MDAT by writing my own code, and then decode those samples by using some tool. In MP4 format, frames are stored in samples, samples are grouped in chunks. So I want to extract the chunks by myself and then decode these chunks by using some tool. Thanks for the reply. – Gurinderbeer Singh Apr 20 '16 at 15:10
  • This can be done with ffmpeg by using a command such as this: `ffmpeg -ss 3.00 -i input.mp4 -c copy -vframes 1 -map 0:v:0 -f data 1.bin` <-- this dumps the entire packet. – Gyan Apr 20 '16 at 15:27

1 Answers1

3

ffmpeg is a collection of libraries. libavformat is used to read and write files(what you are doing with your own code), libavcodec can be used on its own to decode samples.

szatmary
  • 29,969
  • 8
  • 44
  • 57
  • this is good information. So libavcodec decode the samples. Is there any dependencies within the samples for decoding. I mean, for examples we have 1000 samples, can libavcodec decode these samples independently. If I want to decode only the 500th sample. Can I do that without using other samples. – Gurinderbeer Singh Apr 21 '16 at 15:35