seanghay / studio

A studio for video editor with GL Transitions.
Apache License 2.0
27 stars 12 forks source link

video transitions instead of images. #3

Open Sudheerbolla opened 3 years ago

Sudheerbolla commented 3 years ago

I know it's possible for videos, but are you planning on extending it to videos in this app?

seanghay commented 3 years ago

@Sudheerbolla I would like to add video transition, but it's quite tricky to do so.

Sudheerbolla commented 3 years ago

@seanghay Can you help me with that. I mean, how to achieve that.

seanghay commented 3 years ago

@seanghay Can you help me with that. I mean, how to achieve that.

Yes, I have some clue on how to do it, but it's taking sometime.

Let me share what I thought:

  1. Load each video and audio sample using MediaExtractor.
  2. Decode them with MediaCodec + MediaFormat.
  3. Send decoded buffer accordingly to OpenGL Surface (Offscreen Surface) to apply transformations such as filter, transition..
  4. Create another MediaCodec for Encoding output buffer from the OpenGL surface.
  5. Make sure timestamps are aligned properly so it won't be messed up.
  6. Merge audios from different videos into a single audio using MediaCodec. (Codec: avc)
  7. Mux the audio buffer and the output video buffer to a single video container using MediaMuxer.

I'm not professional in this field, so if I said anything wrong please correct me.

seanghay commented 3 years ago

@Sudheerbolla That's what I can think of.

kekhong95 commented 3 years ago

Hi @seanghay , I have problem when blur video when progress in openGL . Do you know solution ? Thanks.

seanghay commented 3 years ago

Hi @seanghay , I have problem when blur video when progress in openGL . Do you know solution ? Thanks.

Hi @kekhong95, can you explain the issue you're facing?

kekhong95 commented 3 years ago

Hi @seanghay

I try to blur video background in openGL same you blur with photo in project . But you using canvas to draw blur bitmap as background . But with video i do not read bitmap to blur , glReadBit will take time . So I want blur it in OpenGL . If you can solution please tell me And I want using gl transition in your project with video it can work ? Thanks for supports

seanghay commented 3 years ago

@kekhong95 You need to render video into a SurfaceTexture and use a shader to make that video blurry in realtime. Video and photo are basically the same. Check out this Shader I wrote: https://github.com/seanghay/studio/blob/master/studio/src/main/java/com/seanghay/studio/gles/shader/filter/GaussianBlurFilterShader.kt

seanghay commented 3 years ago

@kekhong95 Also check this sample as well, it might help. https://github.com/google/grafika

kekhong95 commented 3 years ago

Hi @seanghay , thanks for information , But when I modify using transition with video , I do not know load currentTexture of fromFrameBuffer. with photo you using Bitmap to texture , with video scene last and next frame , but I do not know them solution to progess it , If you can solution please share to me.

seanghay commented 3 years ago

@kekhong95 you'll need to use MediaCodec + MediaExtractor to decode video into SurfaceTexture. You'll also need to manage audio as well. MediaCodec is the key.

seanghay commented 3 years ago

For merging multiple .mp4 files(video + audio) you'll have to arrange timestamp for reach individual video.

kekhong95 commented 3 years ago

No no . I do not know progess with frame when transition , not video process , I know video decoder and encoder with MediaCodec + MediaExtractor + MediaMux , but i do know process transition frame with video image

kekhong95 commented 3 years ago

I modify onDraw of VideoComposer for video progress , but it not work ? Do I mistake ?

abkoradiya commented 3 years ago

I modify onDraw of VideoComposer for video progress , but it not work ? Do I mistake ?

Have you succeeded with video drawing?

abkoradiya commented 3 years ago

@seanghay Can you help me with that. I mean, how to achieve that.

Yes, I have some clue on how to do it, but it's taking sometime.

Let me share what I thought:

  1. Load each video and audio sample using MediaExtractor.
  2. Decode them with MediaCodec + MediaFormat.
  3. Send decoded buffer accordingly to OpenGL Surface (Offscreen Surface) to apply transformations such as filter, transition..
  4. Create another MediaCodec for Encoding output buffer from the OpenGL surface.
  5. Make sure timestamps are aligned properly so it won't be messed up.
  6. Merge audios from different videos into a single audio using MediaCodec. (Codec: avc)
  7. Mux the audio buffer and the output video buffer to a single video container using MediaMuxer.

I'm not professional in this field, so if I said anything wrong please correct me.

Can you participate in hecktoberfest event with this repo? If so, other developer can help for this implementation.

Sudheerbolla commented 3 years ago

Hello @kekhong95 , @abkoradiya . Did any of you guys have implemented it for videos. I am about to start working on this and need your help/inputs regarding this.

Thanks in advance.