Video

subliminal.video.VIDEO_EXTENSIONS = (u'.3g2', u'.3gp', u'.3gp2', u'.3gpp', u'.60d', u'.ajp', u'.asf', u'.asx', u'.avchd', u'.avi', u'.bik', u'.bix', u'.box', u'.cam', u'.dat', u'.divx', u'.dmf', u'.dv', u'.dvr-ms', u'.evo', u'.flc', u'.fli', u'.flic', u'.flv', u'.flx', u'.gvi', u'.gvp', u'.h264', u'.m1v', u'.m2p', u'.m2ts', u'.m2v', u'.m4e', u'.m4v', u'.mjp', u'.mjpeg', u'.mjpg', u'.mkv', u'.moov', u'.mov', u'.movhd', u'.movie', u'.movx', u'.mp4', u'.mpe', u'.mpeg', u'.mpg', u'.mpv', u'.mpv2', u'.mxf', u'.nsv', u'.nut', u'.ogg', u'.ogm', u'.omf', u'.ps', u'.qt', u'.ram', u'.rm', u'.rmvb', u'.swf', u'.ts', u'.vfw', u'.vid', u'.video', u'.viv', u'.vivo', u'.vob', u'.vro', u'.wm', u'.wmv', u'.wmx', u'.wrap', u'.wvx', u'.wx', u'.x264', u'.xvid')

Video extensions

subliminal.video.SUBTITLE_EXTENSIONS = (u'.srt', u'.sub', u'.smi', u'.txt', u'.ssa', u'.ass', u'.mpl')

Subtitle extensions

class subliminal.video.Video(name, release_group=None, resolution=None, video_codec=None, audio_codec=None, imdb_id=None, hashes=None, size=None, subtitle_languages=None)

Base class for videos

Represent a video, existing or not, with various properties that defines it. Each property has an associated score based on equations that are described in subclasses.

Parameters:
  • name (string) – name or path of the video
  • release_group (string) – release group of the video
  • resolution (string) – screen size of the video stream (480p, 720p, 1080p or 1080i)
  • video_codec (string) – codec of the video stream
  • audio_codec (string) – codec of the main audio stream
  • imdb_id (int) – IMDb id of the video
  • hashes (dict) – hashes of the video file by provider names
  • size (int) – byte size of the video file
  • subtitle_languages (set) – existing subtitle languages
class subliminal.video.Episode(name, series, season, episode, release_group=None, resolution=None, video_codec=None, audio_codec=None, imdb_id=None, hashes=None, size=None, subtitle_languages=None, title=None, tvdb_id=None)

Episode Video

Scores are defined by a set of equations, see get_episode_equations()

Parameters:
  • series (string) – series of the episode
  • season (int) – season number of the episode
  • episode (int) – episode number of the episode
  • title (string) – title of the episode
  • tvdb_id (int) – TheTVDB id of the episode
class subliminal.video.Movie(name, title, release_group=None, resolution=None, video_codec=None, audio_codec=None, imdb_id=None, hashes=None, size=None, subtitle_languages=None, year=None)

Movie Video

Scores are defined by a set of equations, see get_movie_equations()

Parameters:
  • title (string) – title of the movie
  • year (int) – year of the movie
subliminal.video.hash_opensubtitles(video_path)

Compute a hash using OpenSubtitles’ algorithm

Parameters:video_path (string) – path of the video
Returns:the hash
Return type:string
subliminal.video.hash_thesubdb(video_path)

Compute a hash using TheSubDB’s algorithm

Parameters:video_path (string) – path of the video
Returns:the hash
Return type:string
subliminal.video.scan_subtitle_languages(path)

Search for subtitles with alpha2 extension from a video path and return their language

Parameters:path (string) – path to the video
Returns:found subtitle languages
Return type:set
subliminal.video.scan_video(path, subtitles=True, embedded_subtitles=True, video=None)

Scan a video and its subtitle languages from a video path

Parameters:
  • path (string) – absolute path to the video
  • subtitles (bool) – scan for subtitles with the same name
  • embedded_subtitles (bool) – scan for embedded subtitles
:parm Video: optionally specify a video if you’ve already detected on
by other means.
Returns:the scanned video
Return type:Video
Raise:ValueError if cannot guess enough information from the path
subliminal.video.scan_videos(paths, subtitles=True, embedded_subtitles=True, age=None)

Scan paths for videos and their subtitle languages

Params paths:

absolute paths to scan for videos

Parameters:
  • subtitles (bool) – scan for subtitles with the same name
  • embedded_subtitles (bool) – scan for embedded subtitles
  • age (datetime.timedelta or None) – age of the video, if any
Returns:

the scanned videos

Return type:

list of Video