VoylinsGamedevJourney / gozen

The modular video editor
https://youtube.com/@voylinsgamedevjourney
GNU General Public License v3.0
145 stars 22 forks source link

Add codec option #21

Closed ZachAR3 closed 1 year ago

ZachAR3 commented 1 year ago

Add an option to select the desired codec used to save the video as. E.g:

match codec:
    "MPEG2":
        var command = [
  'ffmpeg', '-y',  # Overwrite output file if it already exists
  '-f', 'image2pipe',  # Input format: image sequence
  '-r', str(25),  # Frame rate
  '-i', '-',  # Read input from pipe
  '-c:v', mpeg2',  # VP9 video codec
  '-b:v', '1M',  # Video bitrate
  '-pix_fmt', 'yuv444p',  # Pixel format - default: yuv420p
  '-f', 'webm',  # Output format: WebM
  'output_video.webm'  # Output file path
]

You could even add and option for AV1 encoding which many editors don't support yet. You could see what encoders the hardware supports via ffmpeg -encoders (source:https://ffmpeg.org/ffmpeg-codecs.html#Encoders)

voylin commented 1 year ago

Would not be too difficult to implement this into the render screen (which is still a wip). We could possible have some advanced settings in which people can select some of the options themselves like which codec to use, what bitrate, which pixel format (this is a difficult one as choosing the wrong one makes your video look so terrible), ...

I'll try to first implement some presets using the data from ffmpeg-encoders and see how that goes. I will have to make the GD Extension for this first, but it is just a matter of creating arguments for all the data required.

voylin commented 1 year ago

50 is taking this into account so I'm closing this issue for organisation purpose.