This lesson is being piloted (Beta version)

Python for AV: Glossary

Key Points

What is Python?
  • Learning to use Python is like learning a new language. It takes practice.

  • Python code is text that a computer interprets as instructions. You can write it with a text editor and run it separately. Or, you can use an integrated tool like Jupyter to write and run it in the same environment.

  • Python can be used to find, move, survey, and transcode AV files.

Running and Quitting
  • Python scripts are plain text files.

  • Use the Jupyter Notebook for editing and running Python.

  • The Notebook has Command and Edit modes.

  • Use the keyboard and mouse to select and edit cells.

  • The Notebook will turn Markdown into pretty-printed documentation.

Transcoding One File
  • Python syntax can be a little tricky, but starting small and building out is a good general strategy

Generating a List of Files
  • Collecting filepaths is often the first step of any AV script

  • The import statement allows you to expand Python’s functionality by loading modules with specialized functions

  • Standard distribution modules are installed with Python. Other modules must be installed

  • Two common modules for listing files with Python are os and glob

  • The filepath is the sequence of parent folders that define the location of a particular file or directory

Moving and Transcoding Files
  • Collecting filepaths is often the first step of any AV script

Lossless Compression and Codec Decisions
  • Transcoding lossy codecs to lossless can yield an increase in size

Finding Out About Files
  • Start with the shortest piece of code and build up your pieces gradually

Finding Out About AV Files
  • Domain specific functions will often require custom tools

Checksums
  • Just because you can in Python, doesn’t mean it’s the most convenient

Creating a Script
  • Once you’ve created code you want to use repeatedly, a script is more useful than a Jupyter Notebook

  • argparse is the Python module for accepting arguments from the command line

  • try and except blocks can be used to run code that may not work in every situation

Data Analysis and Visualization (Bonus)
  • Automate your CSV/Excel

  • Analyze data as you go

Glossary

FIXME