![]() ![]() def grabUserInput(): def filterInput(message, default): user_input = input (message) if user_input = "": user_input = default return user_input print("Hit enter for default values\n") user_input_dict = user_input_dict = filterInput("Input File: ", ""). Within that function I defined a nested function called filterInput() which is responsible for formatting the input message the user will see and setting a default value so the user can simply hit enter if they don’t wish to change the default value. I created a function grabUserInput() which prompts a user for input, stores that input in a dictionary, and returns that dictionary to be used in another function. import subprocess ffmpeg = "/usr/local/bin/ffmpeg" ![]() ![]() Then I setup a variable to define where the ffmpeg binary is located. More info about subprocess can be found here. The first thing I do is import the subprocess module which allows me to run shell commands from Python. I’ll go through the process of how I created the script and break down each section. To help with this I decided to create a Python script to help automate the common task of taking a video file and encoding it to an MP4 encoded with x264. Running FFmpeg commands from a Python ScriptįFmpeg is one of my favorite tools for encoding video files, but even as someone who has used it for a few years the syntax can still be pretty tricky. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |