vp6 alpha codec

fanno
2007-02-16
2012-07-19
  • fanno
    fanno
    2007-02-16

    do you happen to have any idea how to decode vp6 with alpha channels ? for width and height ?

    fanno

     
    • Ingo Oppermann
      Ingo Oppermann
      2007-02-16

      Thanks for the sample files. I will take a look at them and try to find the pattern for detecting the width and height.

      Ingo

       
    • fanno
      fanno
      2007-02-18

      i finaly figured it out ...

      i notised that your height/ width calculatsion is "off" ? there's modifyer to calculate when a reselutsion dont match 16 it looks like this ( in php ) i dont know what mode is is acterly used for $this->frametype == 1 ======= keyframe. cany only get height and width off keyframes ... if you want to see the entire source you can find it on http://fanno.dk/ under os projects (flv4php)

              // format layout taken from libavcodec project (http://ffmpeg.mplayerhq.hu/)
              case $this->CODEC_ON2_VP6 :
                  if($this->frametype == 1) {          
                      $adjW = $bits->getInt(4);
                      $adjH = $bits->getInt(4);
                      $mode = $bits->getInt(1);
                      if ($mode === 0) {
                          $bits->seek(15, SEEK_CUR);
                          $this->height = $bits->getInt(8) * 16 - $adjH;
                          $this->width = $bits->getInt(8) * 16 - $adjW;
                      }
                  }
              break;
      
              case $this->CODEC_ON2_VP6ALPHA :
                  if($this->frametype == 1) {
                      $adjW = $bits->getInt(4);
                      $adjH = $bits->getInt(4);
                      $mode = $bits->getInt(1);
                      // mode is for ? unknown ?
                      if ($mode === 0) {
                          $bits->seek(39, SEEK_CUR);
                          $this->height = $bits->getInt(8) * 16 - $adjH;
                          $this->width = $bits->getInt(8) * 16 - $adjW;                 
                      }
                  }
              break;
      
       
    • Ingo Oppermann
      Ingo Oppermann
      2007-02-16

      Probably it's very similar to the vp6 w/o alpha channel, but I don't have any FLV files with this codec, so I can't test it. If you know where to get such a sample file, please let me know.

      Ingo

       
      • fanno
        fanno
        2007-02-16

        They use them at http://www.msdewey.com/ codec id 5 ( cp6 alpha ), i have tryed looking at it for some time, but i cant find a patten.


        fanno

         
    • Ingo Oppermann
      Ingo Oppermann
      2007-02-18

      Thanks for the hint, but I also figured it out :) A look at the FLV specs revealed that the VP6FLVALPHAVIDEOPACKET has 3 more bytes in the header. So it was just trial and error to modify the non alpha code and to see what happens. It worked very well with the samples you provided.

      I just released a new version of yamdi.