Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timestamp argument in Encode function #1

Closed
msalai opened this issue Oct 5, 2018 · 6 comments
Closed

timestamp argument in Encode function #1

msalai opened this issue Oct 5, 2018 · 6 comments

Comments

@msalai
Copy link

msalai commented Oct 5, 2018

Hello, can you tell me what is the purpose of timestamp argument in Encode function? I think it is delay between two frames but it could also be time from the beginning. However, there are no changes on the video when i change that parameter. How would i inform encoder about time between two frames?

@secile
Copy link
Owner

secile commented Nov 2, 2018

Thank you for question.
Since this is only a wrapper library, you have to know about
original openh264 implementation.

Regarding from the article below, time stamp is two frames time interval in ms.
cisco/openh264#2391

And openh264 have rate control flag.
The flags are RC_QUALITY_MODE, RC_BITRATE_MODE, RC_TIMESTAMP_MODE, and so on.
Currentry, in my OpenH264Lib, bit rate control flag is 'RC_QUALITY_MODE'
in Encoder::Setup function.

So, it might be set

base.iRCMode = RC_TIMESTAMP_MODE;

instead of

base.iRCMode = RC_QUALITY_MODE;

If so, my OpenH264Lib have timestamp argument in Encode function,
but it is not work correctry.

@secile
Copy link
Owner

secile commented Jun 4, 2019

Handling timestamp processing was incorrect.
It seems that I do not have to modify timestamp manually.

I deleted timestamp argument in encode function.
Encode(Bitmap, timestamp) function is obsoleted.
Please use Encode(Bitmap) function instead.

@secile secile closed this as completed Jun 4, 2019
@yaakovyitzchak
Copy link

@secile how can I encode frames that were can captured with no set framerate then? I have the timestamps, why was this tribes, how can I get the same functionality, I need to line up the frames with the audio, and they weren't captured at a set framerate

@secile
Copy link
Owner

secile commented Oct 23, 2020

Hello! You are saying that you have images and audio sampling data with different frame rate? You have images and audios that are not regularly sampled?
Anyway, openh264 requires frame rate parameter, so I think you have to calculate frame rate from timestamps, and you need to complement lacked image.

@yaakovyitzchak
Copy link

@secile no that would be impossible since it's not a set rate, I know you had a timestamp parameter before but it was "obsolete", in the original dll there is probably a way to do it

@secile
Copy link
Owner

secile commented Oct 23, 2020

Encode(bmp, timestamp) overload is obsoleted because it seemed that timestamp value is not effect to output h264 frame data.

As I writed above, My library uses 'RC_QUALITY_MODE'. It may work fine if change the mode to 'RC_TIMESTAMP_MODE'. I don't know it works as you expected, but I will describe how to use timestamp and 'RC_TIMESTAMP_MODE'.
Even thought you use 'RC_TIMESTAMP_MODE', you have to pass fps parameter in Setup(). Set fps as maximum frame rate value.

[Encoder.cpp]
line48: add argument 'float timestamp'.
line60: uncomment the line.
line38: add argument 'float timestamp'.
line42: replace to 'int rc = Encode(ptr, timestamp)'
line24: add argument 'float timestamp'.
line30: replace to 'int rc = Encode(i420, timestamp)'
line18-21:delete lines
line125: replace from 'RC_QUALITY_MODE' to 'RC_TIMESTAMP_MODE'.

[Encoder.h]
line44: add argument 'float timestamp'.
line45: add argument 'float timestamp'.
line46: add argument 'float timestamp'.
line41-42:delete lines

[Your project]
call Encode(bmp, timestamp)
timestamp is two frame time interval in second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants