Hi Gopinath,
1 Can you try the case of maxing out CPU?
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
2 Do you run it with gst command? If yes, please share the command also.
I cannot give you the sample application/apk for now, because it contains confidential information.Hope you understand. By the mean time I will try to simulate this use cases by excluding those information.
Here is an update. When I tested with skype video call from Jetson device to PC, the delay is less than 80 milliseconds. I am not sure what encoder they are using.
Here are few other questions I have.
what are all the hardware and software video encoders supported by TK1?
what are all the hardware and software video decoders supported by TK1?
When I checked with OMX.google.h264.encoder, the latency is reduced very much. It is approximately 300 milliseconds.
So here is summery.
Decoding in H264 hardware decoder
Encoding in H264 hardware encoder - latency delay in Encoder is ~800 milliseconds.
Decoding in H264 hardware decoder
Encoding in H264 software google encoder - latency delay in Encoder is ~300 milliseconds.
Decoding in H263 hardware decoder
Encoding in H264 hardware encoder - latency delay in Encoder is ~350 milliseconds.
I have another question. Is it H264 hardware encoder and decoder is separate unit? or it is combined one? I mean, If both are in use, then delay seems increasing…Is that be a reason??
Hi Gopinath,
No, it should not be the reason. H264 hw encoder and decoder are separate units and work independently on tk1. However, I am not able to explain where the delay comes from as I don’t have the detail of the video call application. But it looks like you can run h264 hw decoder and h264 sw google encoder to get better performance in the usecase.
We just started to home in on where the issue is occurring.
Whn I adjusted the timeout value of MediaCodec.dequeueOutputBuffer()method in our application, inconsistently I can see there is no latency.
(at first the value is (1000000 / 30) microseconds , ie 33ms tuned to 30 frames per second and by reducing(to 7 ms) this will results in avoiding latency, but not consistent.)
It seems timing/signalling flaw in the way that the Synchronous MediaCodec API works.
My understanding is the same application code works fine with software encoder where as in case of hw encoder I am getting this inconsistent and synchronous issue. Do I need to handle any thing specific in my application to make hw encoder works fine?
Hi Gopinath, let me try if I can simulate your usecase via native sample app
frameworks\av\cmds\stagefright\codec.cpp
Please check mediacodec.tar.gz. I get ~130 ms in my simultaneous encoding/decoding test. There can be mismatch between our tests. Please specify it so that I can simulate your usecase
Thanks for these test results. To be more specific,my results includes network delay since our application is transmitting the encoded video over internet. I guess that may be the case. I will check that too and tell you the results.
Here is an important update. It seems we have found out the root cause of this issue as below.
Jetson hw encoder is outputting a LevelID of 50 (5.0), where as other devices I have tested uses encoder with LevelID 13 (1.3). To determine if this was causing the delay, the LevelID in the Sequence Header was altered in a test sequence from 50 to 13, the delay disappeared.
So my question now is, where this LevelID of encoders are mentioned in Jetson. I have checked with media_profiles.xml in Jeston and it is something like below.
<!--
The VideoEditor Export codec profile and level values
correspond to the values in OMX_Video.h.
E.g. for h264, profile value 1 means OMX_VIDEO_AVCProfileBaseline
and level 512 means OMX_VIDEO_AVCLevel31.
Please note that the values are in decimal.
These values are for video encoder.
-->
<!--
Codec = h.264, Baseline profile, level 4
-->
<ExportVideoProfile name="h264" profile="1"
level="2048" />
In the above code what is level=2048 means? But I didn’t get much information about changing this level ID. Can you help me on this?
Hi Gopinath,
Please check if configuring the following setting to hw h264 encoder helps:
int width = 352;
int height = 288;
mOutputFormat->setInt32(“bitrate”, 768000);
mOutputFormat->setInt32(“profile”, OMX_VIDEO_AVCProfileBaseline);
mOutputFormat->setInt32(“level”, OMX_VIDEO_AVCLevel13);
Thanks for your support. I have done the #15 changes.
Is there any way to verify the levelID1.3 in your encoder.cpp application?
By the mean time, I will make this changes in my application and there I will be able to verify this in TCP dump, since it is transmitted over internet.