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/DRA725: Read h.264 file frame-len tools

Part Number: DRA725

Tool/software: Linux

Hi,

  i test  video decode, viddec3test  need the h.264 file frame-len;  

  i  use the  ESEyeApp_lite.exe  tool on the windows , can acquire the frame-len.

 but i want to read h.264 file  acquire the frame-len. on the evm board. 

  can you offer  command tools or  how use demux  packaging.

Regards,

Cesar

  • Hi Cesar,
    If you don't want to use frame-length file then application has to allocate a large input buffer
    which can hold say 10 frames, and after every VIDDEC3_process, input data needs to be shifted up.
    
    In this case, you need to make these changes in viddec3test.
    1) Allocate a large input buffer say 4MB or 8MB and set numBytes = size of valid bytes in the input buffer.
       validBytes = sizeof(inputbuffer);
        fread(decoder->input,  validBytes,  1, decoder->inFile);
    
    2) After VIDDEC3_process call, memmove outArgs->bytesConsumed bytes up in the buffer, so that second frame's data is now at first byte position of input buffer.
    memmove(decoder->input,   decoder-input+outArgs->bytesConsumed,   validBytes - outArgs->bytesConsumed);
    
    3) Keep a track of how many bytes are left in the input buffer so that you load the remaining bytes from the file to input buffer. 
      For this you can set a threshold. Example
      if(remaining bytes <= 10% of inputBufferSize) 
         fread remaining bytes from file.
    
    Ramprasad
    Hi Cesar,

    I am not able to post the answer. Please refer this attached text.

    Ramprasad

  • Hi Cesar,
    If you don't want to use frame-length file then application has to allocate a large input buffer
    which can hold say 10 frames, and after every VIDDEC3_process, input data needs to be shifted up.

    In this case, you need to make these changes in viddec3test.
    1) Allocate a large input buffer say 4MB or 8MB and set numBytes = size of valid bytes in the input buffer.
    validBytes = sizeof(inputbuffer);
    fread(decoder->input, validBytes, 1, decoder->inFile);

    2) After VIDDEC3_process call, memmove outArgs->bytesConsumed bytes up in the buffer, so that second frame's data is now at first byte position of input buffer.
    memmove(decoder->input, decoder-input+outArgs->bytesConsumed, validBytes - outArgs->bytesConsumed);

    3) Keep a track of how many bytes are left in the input buffer so that you load the remaining bytes from the file to input buffer.
    For this you can set a threshold. Example
    if(remaining bytes <= 10% of inputBufferSize)
    fread remaining bytes from file.

    Ramprasad
  • Hi Ramprasad,

    thanks, i solve the problem use your method.

    Regards,
    Cesar