This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: File size increases after H.264 decode/encode

Part Number: AM5728

Tool/software: Linux

Hi Champs,

I used a h.264 sample file in a processor linux sdk and executed a GStreamer pipleline as following on am572x evm. The pipeline only decode the sample file, and then encode.
The size of the generated file is 41.7MB. It's so bigger than the original one, 1.8MB.
Is there anything wrong in the pipeline?

gst-launch-1.0 --gst-debug=1 -v filesrc location=/usr/share/ti/video/TearOfSteel-Short-720x420.264 num-buffers=600
! queue \
! h264parse \
! ducatih264dec \
! vpe \
! 'video/x-raw,format=(string)NV12,width=720,height=420, framerate=(fraction)30/1' \
! queue \
! ducatih264enc intra-interval=30 inter-interval=1 bitrate=1024 qpi=10 qp-max-i=40 qp-min-i=10 level=level-51 \
  rate-preset=user-defined rate-control-params-preset=rate-control-params-preset-user-defined rate-control-algo=0 \
! h264parse \
! filesink location=TearOfSteel-Short-720x420_qpmaxi40.264


Regards,
j-breeze

  • The software team have been notified. They will respond here.
  • Hi,

    Can you share both the streams? You can cut that short if they are too big. Few frames sufficient.

    Which version of Encoder & decoder are you using?

    Did you use TIs encoder to generate the original file of 1.8Mb?

  • Hi,

    I used a h.264 sample file in a processor linux sdk in a SD card that comes w/ am5728 gp evm.
    First, decode the sample file, then encode to generate h.264 file again in the pipeline. I excute the pipeline on the evm that booted from the SD card.

    The size of the original h.264 file(TearOfSteel-Short-720x420.264) is 1.8Mb and the size of the re-generated h.264 file(TearOfSteel-Short-720x420_qpmaxi40.264) is 41.7Mb.
    Dose it make sense?

    Regards,
    j-breeze

  • Hi,
    Ok, I have the original file. The properties original & the re-encoded files might be different. That can be the reason for your observation. 

  • Hi,

    I'm not sure what parameter set is used for the original h.264 file. The parameter set I used is in the GStreamer pipeline.
    If you have any information about the original parameter set, please let me know.

    Regards,
    j-breeze

  • Hi,
    The original file is encoded as :
    HIGH-Profile, Level 3.0,
    has I,P,B frames in it.
    The re-encoded params are different to the one in original file. If you could share the re-encoded stream(30-frames should be sufficient) I can analyse more.

    You can get these properties from the analyser elecard-stream eye.

  • Hi,

    Thank you for your information.
    I'll try to get the properties. But could you please give me some time to do it because I'm not familiar w/ the analyzer.

    Regards,
    j-breeze

  • Hi,
    Ok. If you can dump & share the re-encoded stream I can check the same here. If you want to check this at your end, compare the properties of both the streams and you will come to know the reason for size.
  • Hello,

    j-breeze said:
    I'm not sure what parameter set is used for the original h.264 file. The parameter set I used is in the GStreamer pipeline.
    If you have any information about the original parameter set, please let me know.

    The default h264enc params that are used in gstreamer encoder element  could be found in gstducatih264enc.c file.

    You could check the h264enc user guide about the enc's params for more information.

    BR
    Margarita

  • Hello j-breeze,

    I am closing this thread. Please feel free to reopen it again.

    BR
    Margarita
  • Hi,

    I was able to see the difference of the properties of the original & the re-encoded files.
    I'd like to share the analyzer Elecard StreamEye outputs for your reference.

    It seems that I can not use the all params of ducatih264enc in a GStreamer pipleline. Is that right?

    Regards,
    j-brreeze

    stream type                         AVC/H.264
    profile                             High
    level                               3.0
    chroma format                       4:2:0
    resolution                          720 x 420
    frame rate                          24
    coding mode                         CABAC
    declared bitrate                    undefined
    duration                            00:00:21:041
    epsnr [504]                         35.56
    frames                              
      count                             505
        I                               8 (1.58%)
        P                               204 (40.39%)
        B                               293 (58.01%)
      size (byte) / encode ratio (avg)  3769 / 120
        I                               35 858 / 12
        P                               5 897 / 76
        B                               1 410 / 321
    bit allocation                      
      max                               6 402 648
      avg                               690 368
      min                               22 816
    qp                                  
      qp min                            0
      qp avg                            30.28
      qp max                            45
    distribution (bits)                 
        total                           30 152 (100.00%)
        mb_skip                         442 (1.47%)
        mb_field_decoding_flag          0 (0.00%)
        mb_type                         898 (2.98%)
        sub_mb_type                     53 (0.18%)
    prediction                          
        pred_mode_flag                  309 (1.03%)
        pred_mode                       619 (2.05%)
        inter_prediction                3 407 (11.30%)
    transform                           
        coded_block_pattern             1 119 (3.71%)
        transform_size_8x8_flag         52 (0.17%)
        mb_qp_delta                     867 (2.88%)
        transform                       21 598 (71.63%)
        pcm_data                        0 (0.00%)
    
    stream type                         AVC/H.264
    profile                             High
    level                               5.1
    chroma format                       4:2:0
    resolution                          720 x 420
    frame rate                          25
    coding mode                         CAVLC
    declared bitrate                    undefined
    duration                            00:00:20:120
    epsnr [502]                         59.99
    frames                              
      count                             503
        I                               17 (3.37%)
        P                               486 (96.62%)
      size (byte) / encode ratio (avg)  87134 / 5
        I                               16 479 / 27
        P                               89 606 / 5
    bit allocation                      
      max                               25 084 000
      avg                               16 757 800
      min                               68 400
    qp                                  
      qp min                            0
      qp avg                            1.36
      qp max                            40
    distribution (bits)                 
        total                           697 078 (100.00%)
        mb_skip                         1 077 (0.15%)
        mb_field_decoding_flag          0 (0.00%)
        mb_type                         1 751 (0.25%)
        sub_mb_type                     0 (0.00%)
    prediction                          
        pred_mode_flag                  881 (0.13%)
        pred_mode                       1 498 (0.21%)
        inter_prediction                3 975 (0.57%)
    transform                           
        coded_block_pattern             7 082 (1.02%)
        transform_size_8x8_flag         912 (0.13%)
        mb_qp_delta                     1 100 (0.16%)
        transform                       678 328 (97.31%)
        pcm_data                        0 (0.00%)
    

    stream type                         AVC/H.264
    profile                             High
    level                               3.0
    chroma format                       4:2:0
    resolution                          720 x 420
    frame rate                          24
    coding mode                         CABAC
    declared bitrate                    undefined
    duration                            00:00:21:041
    epsnr [504]                         35.56
    frames                              
      count                             505
        I                               8 (1.58%)
        P                               204 (40.39%)
        B                               293 (58.01%)
      size (byte) / encode ratio (avg)  3769 / 120
        I                               35 858 / 12
        P                               5 897 / 76
        B                               1 410 / 321
    bit allocation                      
      max                               6 402 648
      avg                               690 368
      min                               22 816
    qp                                  
      qp min                            0
      qp avg                            30.28
      qp max                            45
    distribution (bits)                 
        total                           30 152 (100.00%)
        mb_skip                         442 (1.47%)
        mb_field_decoding_flag          0 (0.00%)
        mb_type                         898 (2.98%)
        sub_mb_type                     53 (0.18%)
    prediction                          
        pred_mode_flag                  309 (1.03%)
        pred_mode                       619 (2.05%)
        inter_prediction                3 407 (11.30%)
    transform                           
        coded_block_pattern             1 119 (3.71%)
        transform_size_8x8_flag         52 (0.17%)
        mb_qp_delta                     867 (2.88%)
        transform                       21 598 (71.63%)
        pcm_data                        0 (0.00%)
    

  • Hello,

    j-breeze said:
    It seems that I can not use the all params of ducatih264enc in a GStreamer pipleline. Is that right?

    Yes, but you could extend the enc's properties in gstreamer.

    We also have a enc demo  which is not using gstreamer. You could find it here:

    http://git.ti.com/glsdk/omapdrmtest/blobs/master/videnc2test.c

    BR
    Margarita

  • Hi Margarita,

    Thank you for your prompt reply and information.

    If I have a question about the extending the enc's properties in gstreamer and the enc demo, I will open a new thread.

    Regards,
    j-breeze