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

Write cli tool to check and transcode videos to the same framerate #48

Closed
2 tasks
NathanLovato opened this issue Nov 1, 2017 · 5 comments
Closed
2 tasks

Comments

@NathanLovato
Copy link
Contributor

NathanLovato commented Nov 1, 2017

To do:

  • Read the framerate with ffmpeg
  • Re-encode videos that have the wrong framerate

A very important tool as you'll find videos with 23.98, 24, 30, etc. fps online and Blender always treats them like they have the same framerate as your project.

Possible solution

From the command line:

  • Check that ffmpeg and/or ffprobe are available. If not, warn the user and exit the program
  • From Python, use ffprobe or another tool to check the framerate and info of every strip in a folder.
  • Store a list of video file paths with info dictionaries (only framerate to start with)
  • Build a list of the different video framerates found
  • Either use a default framerate to transcode if it's set or let the user pick one valid framerate from a list
  • Transcode the videos with ffmpeg and the -r option. Be sure to use ntsc and other built-in keywords for non-integer rates (not 29.98 etc.).

Feel free to ask help with the ffmpeg commands!

Extra notes

If you know a standard python lib that does it or a lightweight cross-platform python 3 script/lib/module we can ship with the add-on, great, we could avoid the external dependency. The lib's license must be compatible with the GPL license Blender uses.
Otherwise FFprobe comes with ffmpeg, which is almost necessary if you do FOSS video editing.

@NathanLovato
Copy link
Contributor Author

Refs

https://askubuntu.com/questions/110264/how-to-find-frames-per-second-of-any-video-file

ffprobe can output json
https://stackoverflow.com/questions/42023222/python-program-which-reads-and-extracts-specific-information-from-json-file-gene

You can read it from ffmpeg too, gotta see if it's the value we need? but as blender uses ffmpeg I'd assume it's what it uses, had the issue a few time where fps and tbr values were different and blender used the fps
https://stackoverflow.com/questions/9896644/getting-ffprobe-information-with-python

@NathanLovato
Copy link
Contributor Author

Maybe merge with build_ffmpeg_proxies and turn it into a cli interface to make use of #62 / needs object orientation in this case to keep the code easy to read and write

@doakey3
Copy link
Contributor

doakey3 commented Feb 4, 2018

I think I've got one started. See this commit.

@NathanLovato
Copy link
Contributor Author

NathanLovato commented Feb 5, 2018 via email

@NathanLovato
Copy link
Contributor Author

Closing as now I consider this beyond the scope of the add-on, that should focus on video editing operations (cut, trim, offset, etc.). A tool like this is much more easily done with shell script too.

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

No branches or pull requests

2 participants