Hello,

i try to encrypt a video and change the code of this player 
http://dranger.com/ffmpeg/tutorial08.html  to play the encrypted video but it 
does works.

i changed ffmpeg.c for encrypt video like this:
before the function av_interleaved_write_frame like this:

 crypt_packet(pkt , pkt->size);
  ret= av_interleaved_write_frame(s, pkt);

the function crypt_packet:
void crypt_packet(AVPacket *packet , int64_t length)
{

char key[] = {1,2};

      int i = 0 , ii = 0;


      for(i =0 , ii = 0;  i< length ; i++ , ii++)
      {
          packet->data[i] = packet->data[i] ^ key[ii] ;

          if( ii == sizeof(key))
          ii=0 ;


      }


}



step 2 i changed tutorial08.c like this:
after the funtion av_read_frame:

av_read_frame(is->pFormatCtx, packet)
 crypt_packet(pkt , pkt->size);

the  crypt_packet function here  are is the same code than the crypt_packet 
function in ffmpeg.c

Thinks and excuse me for my English, it is not my native language.

Hicham.

_________________________________________________________________
Appelez vos amis de PC à PC -- C'EST GRATUIT
http://get.live.com/messenger/overview
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to