libstreaming icon indicating copy to clipboard operation
libstreaming copied to clipboard

embed timestamp (date and time in video)

Open moster67 opened this issue 9 years ago • 7 comments

Great Library. Is it possible to embed a timestamp (showing date and time)? I don't want to make an overlay but that the timestamp is included in the streaming video? Something like a surveillance camera.

We were thinking to first generate a bitmap from a label and then draw it on the Surfaceview. Any ideas?

moster67 avatar Apr 16 '16 19:04 moster67

Yes, you can do this, with streaming mode MODE_MEDIACODEC_API_2 on the video track. Then draw the bitmap in a similar manner to how the video is drawn. Take a look at create2D Texture in GLUtil and the official android docs for drawing in opengl.

sbaar avatar Apr 16 '16 20:04 sbaar

Thank you sbaar for your reply. Sounds reassuring that it is possible. Could the code here: [http://pastebin.com/ThGKiHi2]

be suitable to adapt to my needs? I have never used OpenGL before so any advice would be most appreciated.

moster67 avatar Apr 16 '16 21:04 moster67

Yes, that type of code, although try it with a solid color bitmap before text to make sure you have it working. Then use the shaders and tutorial here http://developer.android.com/training/graphics/opengl/draw.html

Remember you can't use the same shader that's being used for the surface texture.

sbaar avatar Apr 16 '16 21:04 sbaar

Do you know if there are any drawbacks using MODE_MEDIACODEC_API_2 instead of the suggested MODE_MEDIARECORDER_API?

moster67 avatar Apr 16 '16 22:04 moster67

Media Recorder is just the default because it's the oldest. Both have bugs, wrt android and this library's implementation, but at least with Media Codec you have visibility to fix them. Media Recorder was a hacky solution because it has to break apart the file and make an educated guess to make the audio sync.

sbaar avatar Apr 16 '16 22:04 sbaar

You're an encyclopedia! Many thanks for you sharing your knowledge. I will try what you suggested tomorrow. Many thanks again.

moster67 avatar Apr 16 '16 22:04 moster67

@moster67 - did you manage to embed timestamp on running video and record same? Can you share the sample code.?

vmjadhav avatar May 04 '19 05:05 vmjadhav