Guest User

Untitled

a guest
Jan 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. while (av_read_frame(pFormatCtx, &packet) >= 0)
  2. {
  3. // Is this a packet from the video stream?
  4. if (packet.stream_index == videoStream)
  5. {
  6. // Decode video frame
  7. avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
  8.  
  9. // Did we get a video frame?
  10. if (frameFinished)
  11. {
  12. // Convert the image from its native format to RGB
  13. sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
  14. if (ThisIsAFrameIWant(pFrameRGB))
  15. {
  16. WRITE FRAME TO NEW MPEG KEEPING AUDIO IN SYNC
  17. }
  18. }
  19. }
  20. }
Add Comment
Please, Sign In to add comment