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.

How could I modify encode code to encode once every 3 seconds?

The platform is dm6446,I want to encode a video once every 3 seconds.Any ideas to modify encode code?I have been reading the encode cade for a week, I know writer.c is to write encoded frame to disk,so to achieve this goal,I should mainly modify writer.c code,right?Cuz I am a newbie,any suggestion or good idea to me?

Thanks a lot,TI engineers!

  • Hi,

    What is your application ? In case you want to encode a stream every 3 second, you first need to provide encoder with frame(i.e. schedule encoder call) every 3 seconds. In order to maintain bitrate for 0.33fps, you need to set appropriate value of targetFrameRate in the ecoder dynamicParams. I am not sure if it supports such fractional valaue, but even if it does not support, you can always play with targetFrameRate and tragetBitrate ratio to get the bitrate of your choice. Writing to file will automaticall happen at 3 seconds if you schedule encoding at every 3 seconds. Bty, file writing is a buffers operation and the speed often depends on the device being used to host the filesystem. It may make your application non realtime.

    regards

    Yashwant

  • My app is set up to encode down to framerates of 1 per sec.  I just have a countdown counter for every captured frame.  When it hits zero I call the encoder.  So if I set it to 30 then it encodes 1 fps.  If you don't set the target framerate then the bitrate will be off.

    John A

  • Thanks,Yashwant.I am sorry I didn't say it clearly,in fact I want to record(not encode) a stream once every 3 seconds,and fps is still about 25 when encoding ,what should I do then?

    regards,

    xiaoyu

  • Xiaoyo,

    I think you need a reference to schedule this thread(record) every  3 sec. As John mentioned, If your app gaurentees to capture frames at 25fps, then you can trigger encode after every 75  frames.

    regards

    Yashwant