Videoreader¶
Auto-generated documentation for musicalgestures._videoreader module.
- Mgt-python / Modules / Musicalgestures / Videoreader
ReadError¶
Base class for file read errors.
mg_videoreader¶
def mg_videoreader(
filename,
starttime=0,
endtime=0,
skip=0,
frames=0,
rotate=0,
contrast=0,
brightness=0,
crop='None',
color=True,
keep_all=False,
returned_by_process=False,
):
Reads in a video file, and optionally apply several different processes on it. These include: - trimming, - skipping, - fixing, - rotating, - applying brightness and contrast, - cropping, - converting to grayscale.
Arguments¶
filenamestr - Path to the input video file.starttimeint/float, optional - Trims the video from this start time (s). Defaults to 0.endtimeint/float, optional - Trims the video until this end time (s). Defaults to 0 (which will make the algorithm use the full length of the input video instead).skipint, optional - Time-shrinks the video by skipping (discarding) every n frames determined byskip. Defaults to 0.framesint, optional - Specify a fixed target number of frames to extract from the video. Defaults to 0.rotateint/float, optional - Rotates the video by arotatedegrees. Defaults to 0.contrastint/float, optional - Applies +/- 100 contrast to video. Defaults to 0.brightnessint/float, optional - Applies +/- 100 brightness to video. Defaults to 0.cropstr, optional - If 'manual', opens a window displaying the first frame of the input video file, where the user can draw a rectangle to which cropping is applied. If 'auto' the cropping function attempts to determine the area of significant motion and applies the cropping to that area. Defaults to 'None'.colorbool, optional - If False, converts the video to grayscale and sets every method in grayscale mode. Defaults to True.keep_allbool, optional - If True, preserves an output video file after each used preprocessing stage. Defaults to False.returned_by_processbool, optional - This parameter is only for internal use, do not use it. Defaults to False.
Returns¶
int- The number of frames in the output video file.int- The pixel width of the output video file.int- The pixel height of the output video file.int- The FPS (frames per second) of the output video file.float- The length of the output video file in seconds.str- The path to the output video file without its extension. The file name gets a suffix for each used process.str- The file extension of the output video file.bool- Whether the video has an audio track.