-1

i have below questions regarding android implementation

  1. How various video codecs differ especially `which are stream based and which are frame based'

  2. Over many forums and questions everyone is talking SPS,PPS,etc., so where i can find enough details about codec(Please mention something other than RFC documents!!) to understand it and use ffmpeg relevantly?

  3. From this Is it possible to use in-built HW Decoders od android devices? If so, How? Do i need to use OpenMax-IL (or AL or DL , i mean which is for what?)

  4. Does ffmpeg supports H264 encoding of RGB (or RGBA) or RGB565(or RGB555) input data through libx264?

  5. If my requirement is only h264 encode & decode, can i use libx264 without ffmpeg?If so any sample/guide?

Community
  • 1
  • 1
nmxprime
  • 1,506
  • 3
  • 25
  • 52

1 Answers1

2

1) This is likely referring to the elementary stream format. Some codecs, like mp3, produce a 'stream' that does not require (but optionally can still be contained in) a separate container (such as mp4 ). Other codecs require a separate container. AVC does both. AVCC format requires a container (along with a sequence header containing the SPS/PPS). While annexB format dose not require a container. see more here: http://www.szatmary.org/blog/25

2) SPS and PPS are basically headers. They contain information that the h.264 decoder needs to be initialized (Such as compression options and video resolution)

3) It depends on the device, but yes. you can use the decoder. Please reference the Android documentation.

4) h.264 requires YUV420p (or in extreme cases YUV444). ffmpeg can do the colorspace conversion before passing the data to x264.

5) libx264 can not decode, nor can it do the RGB->YUV colorspace conversion.

szatmary
  • 29,969
  • 8
  • 44
  • 57
  • Thank You, For 1).In video_decode_example of api-example.c they mentioned followings: `NOTE1: some codecs are stream based (mpegvideo, mpegaudio)` & `BUT some other codecs (msmpeg4, mpeg4) are inherently frame based`. That's why i asked it. – nmxprime Jan 10 '14 at 04:39
  • 1
    Updated answer based on comments. – szatmary Jan 10 '14 at 18:41
  • Reading your blog keenly. As you wrote, `How these packets are stored and transmitted is left open to the integrator`,would mean, i can pack the data in any convenient form i feel comfort? Does it mean i still stick with H264/AVC standard? – nmxprime Jan 16 '14 at 15:09
  • 1
    Yes, as long as you also handle the unpacking. But each container can define its own standard. so if you want to use mp4, you need to follow their standard. – szatmary Jan 16 '14 at 20:05
  • Thank you.Comparing with the NALU you posted in your blog, it seems my NALU headers are wrong. the SPS, PPS & iDR data seems not matching the byte count. `0x0 0x0 0x0 0x1 0x67 0x64 0x0 0x1e 0xac 0xe4 0x7 0x81 0x96 0x84 0x0 0x0 0x3 0x0 0x4 0x0 0x0 0x3 0x0 0xc8 0x3c 0x58 0xb4 0x48 0x0 0x0 0x0 0x1 0x68 0xeb 0xec 0xb2 0x2c `. What could be the problem? – nmxprime Jan 17 '14 at 04:44
  • comment on `5) x264 can not decode, **nor** **can** **it** **do** **the** **RGB->YUV** **colorspace** **conversion**.', then why configure script of x264 have `--disable-swscale` ? and many occurance relating swscale found inside configure script itself? – nmxprime Jan 23 '14 at 10:48
  • 1
    Small type-o fixed. The command line tool 'x264' does link to libswswcale. libx264 does not. – szatmary Jan 23 '14 at 16:51
  • *Unless something changed since last time I looked – szatmary Jan 23 '14 at 17:02
  • **3)** using h/w h264 encoder is also possible. When you are speaking about _old_ Android devices, how old do you mean? – Alex Cohn Jan 23 '14 at 18:09
  • @AlexCohn, not much old. I want to use hardware encode/decode in ICS. i.e., without using `MediaCodec` available on 4.1.2, i want to use hardware encode/decode functionality on above 4.0 versions!Please point me, what to study for this, i don't want to use ffmpeg(though building with neon enabled,no improvement compared to non-neon build). I am confused with many posts saying `stagefright`, `OMX` etc., So please point me to get started! I am newbie only – nmxprime Jan 24 '14 at 04:04
  • Look at http://stackoverflow.com/questions/8613436/how-to-use-ffmpeg-libavcodec-libstagefright – Alex Cohn Jan 24 '14 at 05:16