Video frame capture: I-frame vs P-frames












0














I'm trying to capture various frames within a x264-encoded video files into png files (in python), and then compare the quality of them:



cap = cv2.VideoCapture(filename);
//get frame_number for saving, and save the frame
cap.set(cv2.CAP_PROP_POS_FRAMES,frame_no);
ret, frame = cap.read()

cv2.imwrite(dir_path+'uniform_frame_'+str(frame_no)+".png", frame);


Now I was wondering if I fetch an I-Frame, does it mean that it has a higher quality than other frames, e.g. P-frames and B-Frames? (inherently, keyframes are not compressed, so they must have higher quality and less noise).










share|improve this question



























    0














    I'm trying to capture various frames within a x264-encoded video files into png files (in python), and then compare the quality of them:



    cap = cv2.VideoCapture(filename);
    //get frame_number for saving, and save the frame
    cap.set(cv2.CAP_PROP_POS_FRAMES,frame_no);
    ret, frame = cap.read()

    cv2.imwrite(dir_path+'uniform_frame_'+str(frame_no)+".png", frame);


    Now I was wondering if I fetch an I-Frame, does it mean that it has a higher quality than other frames, e.g. P-frames and B-Frames? (inherently, keyframes are not compressed, so they must have higher quality and less noise).










    share|improve this question

























      0












      0








      0


      1





      I'm trying to capture various frames within a x264-encoded video files into png files (in python), and then compare the quality of them:



      cap = cv2.VideoCapture(filename);
      //get frame_number for saving, and save the frame
      cap.set(cv2.CAP_PROP_POS_FRAMES,frame_no);
      ret, frame = cap.read()

      cv2.imwrite(dir_path+'uniform_frame_'+str(frame_no)+".png", frame);


      Now I was wondering if I fetch an I-Frame, does it mean that it has a higher quality than other frames, e.g. P-frames and B-Frames? (inherently, keyframes are not compressed, so they must have higher quality and less noise).










      share|improve this question













      I'm trying to capture various frames within a x264-encoded video files into png files (in python), and then compare the quality of them:



      cap = cv2.VideoCapture(filename);
      //get frame_number for saving, and save the frame
      cap.set(cv2.CAP_PROP_POS_FRAMES,frame_no);
      ret, frame = cap.read()

      cv2.imwrite(dir_path+'uniform_frame_'+str(frame_no)+".png", frame);


      Now I was wondering if I fetch an I-Frame, does it mean that it has a higher quality than other frames, e.g. P-frames and B-Frames? (inherently, keyframes are not compressed, so they must have higher quality and less noise).







      video ffmpeg python video-encoding video-capture






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 11 at 16:21









      Tina J

      1718




      1718






















          1 Answer
          1






          active

          oldest

          votes


















          2














          All frames within an encoded video stream are compressed; I-frame simply indicates that the picture can be reconstructed without reference to other coded pictures.



          Now, since I-frames are typically used as references for other pictures, a smart encoder goes easy on the quantization, so they typically are of greater quality. P-frames have more quantization applied and B-frames even more.






          share|improve this answer





















          • Thanks. So the saved frame files usually have higher qualities.
            – Tina J
            Sep 11 at 16:35










          • @TinaJ Usually, yes, unless while encoding, somebody played with the settings. I-frames are more costly to encode than P- or B-frames, so there is a tradeoff to be made. See: en.wikibooks.org/wiki/MeGUI/x264_Settings#ipratio
            – slhck
            Sep 13 at 11:20










          • @slhck btw another quick question: what is the intervals between I-frames? I noticed 1 every FPS in the videos I saw (e.g. 1 per 30 frames). Is it always the case? I thought it is content dependent.
            – Tina J
            Sep 13 at 16:25










          • It's variable - user can force a constant interval or let encoder decide with some soft constraints like max and min interval.
            – Gyan
            Sep 13 at 16:48










          protected by Community Dec 4 at 10:47



          Thank you for your interest in this question.
          Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



          Would you like to answer one of these unanswered questions instead?














          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          All frames within an encoded video stream are compressed; I-frame simply indicates that the picture can be reconstructed without reference to other coded pictures.



          Now, since I-frames are typically used as references for other pictures, a smart encoder goes easy on the quantization, so they typically are of greater quality. P-frames have more quantization applied and B-frames even more.






          share|improve this answer





















          • Thanks. So the saved frame files usually have higher qualities.
            – Tina J
            Sep 11 at 16:35










          • @TinaJ Usually, yes, unless while encoding, somebody played with the settings. I-frames are more costly to encode than P- or B-frames, so there is a tradeoff to be made. See: en.wikibooks.org/wiki/MeGUI/x264_Settings#ipratio
            – slhck
            Sep 13 at 11:20










          • @slhck btw another quick question: what is the intervals between I-frames? I noticed 1 every FPS in the videos I saw (e.g. 1 per 30 frames). Is it always the case? I thought it is content dependent.
            – Tina J
            Sep 13 at 16:25










          • It's variable - user can force a constant interval or let encoder decide with some soft constraints like max and min interval.
            – Gyan
            Sep 13 at 16:48
















          2














          All frames within an encoded video stream are compressed; I-frame simply indicates that the picture can be reconstructed without reference to other coded pictures.



          Now, since I-frames are typically used as references for other pictures, a smart encoder goes easy on the quantization, so they typically are of greater quality. P-frames have more quantization applied and B-frames even more.






          share|improve this answer





















          • Thanks. So the saved frame files usually have higher qualities.
            – Tina J
            Sep 11 at 16:35










          • @TinaJ Usually, yes, unless while encoding, somebody played with the settings. I-frames are more costly to encode than P- or B-frames, so there is a tradeoff to be made. See: en.wikibooks.org/wiki/MeGUI/x264_Settings#ipratio
            – slhck
            Sep 13 at 11:20










          • @slhck btw another quick question: what is the intervals between I-frames? I noticed 1 every FPS in the videos I saw (e.g. 1 per 30 frames). Is it always the case? I thought it is content dependent.
            – Tina J
            Sep 13 at 16:25










          • It's variable - user can force a constant interval or let encoder decide with some soft constraints like max and min interval.
            – Gyan
            Sep 13 at 16:48














          2












          2








          2






          All frames within an encoded video stream are compressed; I-frame simply indicates that the picture can be reconstructed without reference to other coded pictures.



          Now, since I-frames are typically used as references for other pictures, a smart encoder goes easy on the quantization, so they typically are of greater quality. P-frames have more quantization applied and B-frames even more.






          share|improve this answer












          All frames within an encoded video stream are compressed; I-frame simply indicates that the picture can be reconstructed without reference to other coded pictures.



          Now, since I-frames are typically used as references for other pictures, a smart encoder goes easy on the quantization, so they typically are of greater quality. P-frames have more quantization applied and B-frames even more.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 11 at 16:33









          Gyan

          14.4k21644




          14.4k21644












          • Thanks. So the saved frame files usually have higher qualities.
            – Tina J
            Sep 11 at 16:35










          • @TinaJ Usually, yes, unless while encoding, somebody played with the settings. I-frames are more costly to encode than P- or B-frames, so there is a tradeoff to be made. See: en.wikibooks.org/wiki/MeGUI/x264_Settings#ipratio
            – slhck
            Sep 13 at 11:20










          • @slhck btw another quick question: what is the intervals between I-frames? I noticed 1 every FPS in the videos I saw (e.g. 1 per 30 frames). Is it always the case? I thought it is content dependent.
            – Tina J
            Sep 13 at 16:25










          • It's variable - user can force a constant interval or let encoder decide with some soft constraints like max and min interval.
            – Gyan
            Sep 13 at 16:48


















          • Thanks. So the saved frame files usually have higher qualities.
            – Tina J
            Sep 11 at 16:35










          • @TinaJ Usually, yes, unless while encoding, somebody played with the settings. I-frames are more costly to encode than P- or B-frames, so there is a tradeoff to be made. See: en.wikibooks.org/wiki/MeGUI/x264_Settings#ipratio
            – slhck
            Sep 13 at 11:20










          • @slhck btw another quick question: what is the intervals between I-frames? I noticed 1 every FPS in the videos I saw (e.g. 1 per 30 frames). Is it always the case? I thought it is content dependent.
            – Tina J
            Sep 13 at 16:25










          • It's variable - user can force a constant interval or let encoder decide with some soft constraints like max and min interval.
            – Gyan
            Sep 13 at 16:48
















          Thanks. So the saved frame files usually have higher qualities.
          – Tina J
          Sep 11 at 16:35




          Thanks. So the saved frame files usually have higher qualities.
          – Tina J
          Sep 11 at 16:35












          @TinaJ Usually, yes, unless while encoding, somebody played with the settings. I-frames are more costly to encode than P- or B-frames, so there is a tradeoff to be made. See: en.wikibooks.org/wiki/MeGUI/x264_Settings#ipratio
          – slhck
          Sep 13 at 11:20




          @TinaJ Usually, yes, unless while encoding, somebody played with the settings. I-frames are more costly to encode than P- or B-frames, so there is a tradeoff to be made. See: en.wikibooks.org/wiki/MeGUI/x264_Settings#ipratio
          – slhck
          Sep 13 at 11:20












          @slhck btw another quick question: what is the intervals between I-frames? I noticed 1 every FPS in the videos I saw (e.g. 1 per 30 frames). Is it always the case? I thought it is content dependent.
          – Tina J
          Sep 13 at 16:25




          @slhck btw another quick question: what is the intervals between I-frames? I noticed 1 every FPS in the videos I saw (e.g. 1 per 30 frames). Is it always the case? I thought it is content dependent.
          – Tina J
          Sep 13 at 16:25












          It's variable - user can force a constant interval or let encoder decide with some soft constraints like max and min interval.
          – Gyan
          Sep 13 at 16:48




          It's variable - user can force a constant interval or let encoder decide with some soft constraints like max and min interval.
          – Gyan
          Sep 13 at 16:48





          protected by Community Dec 4 at 10:47



          Thank you for your interest in this question.
          Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



          Would you like to answer one of these unanswered questions instead?



          Popular posts from this blog

          Сан-Квентин

          8-я гвардейская общевойсковая армия

          Алькесар