Posted By

izaakschroeder on 01/04/10


Tagged


Versions (?)

s


 / Published in: C
 

  1. void ToggleRecording()
  2. {
  3. if (IsRecording)
  4. {
  5. IsRecording = false;
  6.  
  7. }
  8. else
  9. {
  10. IsRecording = true;
  11. codec = avcodec_find_encoder(CODEC_ID_H264);
  12. c = avcodec_alloc_context();
  13. c->bit_rate = 0;
  14. c->width = (Width/2)*2; //This probably looks stupid, but it works as resolution must be multiple of 2
  15. c->height = (Height/2)*2;
  16. c->time_base= (AVRational){1,fps};
  17. c->gop_size = 10; // emit one intra frame every ten frames
  18. c->max_b_frames = 1;
  19. c->pix_fmt = PIX_FMT_YUV420P; //The only one H264 supports :(
  20.  
  21. }
  22. }

Report this snippet  

You need to login to post a comment.