3d0c/gmf

[Example request] The most asked use case on Stackoverflow: a bunch of images to a video (mp4/h264)

denismakogon opened this issue · 5 comments

Would someone mind to post an example of an application that takes a bunch of images and puts them inside a video (please, avoid any references to opencv).

3d0c commented

Could you please clarify your request, what does it mean "place inside video", you wanna make a video from sequence of images... or what? Please give some use case.

Sorry for confusing you. So, the idea is - take a video file, split that onto images, and put them to a new video file. So, the original and a new video might be the same (ignoring sound).

3d0c commented

If the only thing you need is to remove audio streams — it could be easily done — take a look at tests and "transcode.go" example. Do you really need to convert frames into images first? If you want to get preview or something, you don't need to encode frames into "images" and then back into stream, you just can get it from original one without conversion.
You can write me directly to xor1@pm.me (in russian)

3d0c commented

sorry for mistake in email - xor1@pm.me

#42 still open, @3d0c what are the options to write an image to a frame?

Following the logic of video stream to JPEG transformation, the bare minimum requirements are:

  • be aware of FPS
  • codec
  • be aware of dimensions (H/W)

what else?

It seems like there has to be introduced new API endpoints:

func (p *Packet) SetFrames(fms []*Frame) error // to set frames
func (p *Packet) SetData(data [] byte) error // to initialize packet with image file content
func (f *Frame) Decode(r io.Reader) (*Frame, error) // to decode frame from image.Image or any other reader