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.

h264fhdvenc codec outputs 0 encoded bytes

I use the h264fhdvenc codec (version 01.10.01.00 November 2009) with the DM6467.

While running TI's DVSDK encode demo, I can see that the encoder outputs 0 encoded bytes when capturing the attached full-screen images.

What is the reason for this?

images.zip
  • Nir,

    Can you share the cfg file & the encoder settings (Params, DynamicParams) that you are using? Also, if possible you can try with the latest H264 Encoder version 1.10.02.03 available at http://software-dl.ti.com/dsps/dsps_public_sw/codecs/DM6467/index_FDS.html and see if the problem persists.

    Does the encoder produc 0 bytes in all cases, irrespective of the input?

    Regards,

    Anirban

  • Anirban,

    Please find attached zip file with the following:

    encode.cfg and encode.tcf which are in my  /opt/dvsdk_2_00_00_22/dm6467_dvsdk_combos_2_05/packages/ti/sdo/servers/encode

    encode_1080p.cfg which are in my application folder (same as encode demo in DVSDK)

    video.c - my video.c file where the parameters of the encoder are set.

    Meanwhile, I will also try the new version.

    Regarding your last question, as long as the video input is the above images, the encoder output 0 encoded bytes. When the video input is not the above images, the encoder works as usual and encodes correctly.

    Thank you,

    Nir

    1080p_encode.zip
  • Anirban,

    I tried the new CODEC but it fails at the early stage of opening (I think it fails on XDM_SETPARAMS), I attached the CE_DEBUG=3 log.

    Regards,

    Nir

  • After some debugging (with the older CODEC) I found out that the 0 bytes output from the encoder might be a result of a previous large amount of output from the encoder.

    I noticed that when I open the 'full screen' image while capturing, the encoder suddenly outputs more that 500000 bytes, while in the normal case it usually outputs less than 100000 bytes. After this happens, the encoder outputs 0 bytes for several next captured frames.

    Is it a normal behaviour for the encoder to output the above size of data?

    regards,

    Nir

  •  

    Hi Nir

     

    >I noticed that when I open the 'full screen' image while capturing, the encoder suddenly outputs more that 500000 bytes, while in the normal case it usually outputs less than >100000 bytes.

     

    Can you please elaborate more on "full screen " image and normal case?

    Can you please share the .264 file with us?

    Also mention the type of RC algo, bitrate you are using for encoding.

    Thank you and Best Regards,

    bhushan.

  • Bhushan,

    Please find a zip file in the first message of this discussion. This zip file contains 2 images: 'fullscreen' and 'squares'.

    My setup is includes a video source which is a desktop PC which serves as the video input to a Davinci DM6467 based board.

    Once I view the 'fullscreen' image on the PC (using fullscreen mode so the image is spread all over the desktop), I can see that in the first instance (capture+encode) of the first frame, the encoder outputs large amount of bytes (more than 300000 bytes) and with the next several frames, the encoder outputs 0 bytes (I can see it using a 'printf' message I added to the encode demo for printing the amount of bytes output from the encoder and not by using the .264 file).

    This happens also with the 'squares' image.

    The 'normal' case is when the video input is not one of the above images.

    What is the RC algo?

    The bitrate I use is 5 Mbits/sec.

    Thank you,

    Nir

     

  •  

    Hi Nir,

     

    >What is the RC algo?

    Rate control algorithm; cbr or vbr?

    I had a look at these images.  Basically encoder is consuming huge bits for first frame itself because the input is kind of artifical pattern.

    The correlation among pixels is very less in these cases and hence bit consumed are high and then you have very less bit budget available for

    remaining frames and possibilty that frames are getting skipped.

    If you take any natural image instead of this then encoding will happen smoothly (any scene from movie etc).  Can you please try that?

    Also try to encode the above images at higher bitrate may be 8 Mbps?

     

    Thank you and Best Regards,

    bhushan

     

  • Bhushan,

    After some tests I made, I found out that even if I tyr to encode at higher bitrate, when the above images are present, the bitrate can rise up to more than 60Mbps!

    This bitrate is very high and in my application I cannot allow that.

    regards,

    Nir

  •  

    Hi Nir,

    As informed you earlier this is happening because of encoding of artificial content (no natural texture) and that too correlation among these pixels is minimal. Request you to encode from live camera or natural scenes.

     

    Thank you and Best Regards,

    bhushan.

     

  • Bhushan,

    Although answer was verified, I saw the same happening with live scenen encode. I have several movies, that while playing them and feeding them to the encoder, there are scenes where the encoder outputs as much as 200000 bytes while in the rest of the movie, it outputs less than 100000 bytes.

    Is there something I can do to improve this situation and have the encoder output always less than 100000 bytes?

    Thank you,

    Nir

  •  

    Hi Nir,

    > I have several movies, that while playing them and feeding them to the encoder, there are scenes where the encoder outputs as much as 200000 bytes while in the rest of >the movie, it outputs less than 100000 bytes.

    >Is there something I can do to improve this situation and have the encoder output always less than 100000 bytes?

    First thing; there is no control on encoder for restricting the every frame encoded bytes less than 100000 .

    The encoder outputs more bytes for some scenes because there is likely chance that scene change might have happened at that frame causing most of the MBs to be encoded as Intra and leading to consumption of more number of bytes. 

     which rate control algorithm you are using?

    Can you try CBR? Also try to see if you can reduce the bitrate to your acceptable video quality benchmark.

    Also you can try adjusting the qunatization parameters.

    It will be good if you can share the encoded video clip.

     

    Thank you and Best Regards,

    bhushan.

     

     

  •  

    Hi Nir,

    Please send me your encoder configuration details as well. 

    Thank you and Best Regards,

    bhushan.

  • Bhushan,

    Please find attached zip file which contains the following:

    encoder output in the file video.264

    encoder params in the file encoder_params.txt

    As you can see from the encoder params, I already use CBR.

    The problematic encoder output can be seen at the end of the video.264 file where there were several consecutive 200K+ bytes output buffers from the encoder.

    Thank you,

    Nir

    encoder_output.zip
  • Hi Nir ,

    I analyzed video.264 file and I dont see any problem in encoder.

    Max encoded frame size in bytes is

    max encoded size  90043

     

    But I dont understand why you are getting the size for couple of frames more than 200K+ bytes . Can you please check that?

    Please find attached spreadsheet where the size of each encoded frame is mentioned for video.264.

    5850.video_stats.zip

    Thank you and Best Regards,

    bhushan

  • Hi Bhushan,

    Sorry, by mistake I recorded the previous video using code which includes a workaround I coded for bypassing the large encoded frame. This workaround ensures that no more than 100000 bytes at a time are pushed to the writer thread.

    I attached a new zip file with the correct video without my workaround. Again, close to the end of this video, there are several frames with more than 100000 and 200000 bytes.

    Regards,

    Nir

    encoder_output.zip
  • Hi Nir,

    Can you please tell me which version of H264 encoder you are using for encoding video.264?

     

    Thank you and Best Regards,

    bhushan.

     

  •  Hi Bhushan,

    As I mentioned in my first post to this issue, I use the h264fhdvenc codec (version 01.10.01.00 November 2009).

    Regards,

    Nir

  •  

    Hi Nir,

    We have analyzed the stream and we dont see any problem in rate control algorithm.  To have finer control on picture size can you please turn on Slices?

    You will need to use sliceMode and sliceUnitSize parameters as mentioned in user guide.

     

    Thank you and Best Regards,

    bhushan

  • Hi Nir,

    Could you please clarify what is the problem if a picture generates too many bits?

    Regards,

    Naveen

     

  • Hi Naveen,

    There are applications (including mine) which are sensitive to network bandwidth use. If the encoder outputs a lot of data and that data should be output to the network, it will require more network bandwidth which might not be available, therefore degrading the video quality at the side of the decoder.

    Regards,

    Nir