pyguymer3.media

A Python sub-module containing a bunch of random media-related functions that I have written over the years. If you want to use some of these functions directly from the command line then you can run python3.12 -m pyguymer3.media --help to see what is available.

Notes

Copyright 2017 Thomas Guymer [1]

References

Modules

CLPI

This sub-module is a native Python implementation of a parser for Blu-ray CLPI files.

MPLS

This sub-module is a native Python implementation of a parser for Blu-ray MPLS files.

does_FLAC_have_padding(fname, /)

does_MP4_have_free(fname, /)

does_media_have_RTP_hints(fname, /, *[, ...])

does_media_have_audio(fname, /, *[, ...])

Return True/False if the media has audio.

does_media_have_subtitle(fname, /, *[, ...])

Return True/False if the media has subtitle.

does_media_have_video(fname, /, *[, ...])

Return True/False if the media has video.

images2gif(imgs, gif, /, *[, chunksize, ...])

Convert a sequence of images to a GIF animation.

images2mp4(imgs, /, *[, cacheDir, ...])

Convert a sequence of images to a MP4 video.

images2pdf(imgs, pdf, /, *[, author, ...])

Convert a sequence of images to a PDF slide pack.

images2webp(imgs, webp, /, *[, exif, fps, ...])

Convert a sequence of images to a WEBP animation.

is_moov_at_beginning_of_MP4(fname, /)

optimise_FLAC(fname1, /, *[, chunksize, ...])

"metaflac" does not modify, but it does touch, the FLAC even if it cannot make it smaller, therefore it is NOT safe to keep on running "metaflac" on the same FLAC over and over again.

optimise_MP4(fname1, /, *[, chunksize, ...])

"mp4file" does modify, and it does touch, the MP4 even if it cannot optimise it, therefore it is NOT safe to keep on running "mp4file" on the same MP4 over and over again.

parse_CLPI_file(br, ip, /)

parse_MPLS_file(br, ip, /)

print_FLAC_blocks(fname, /)

print_MP4_atoms(fname, /)

return_ISO_duration(fname, /, *[, cacheDir, ...])

return_ISO_palette(fname, /, *[, cacheDir, ...])

return_ISO_video_frame_rate(fname, /, *[, ...])

return_ISO_video_size(fname, /, *[, ...])

return_MP4_audio_profile(fname, /, *[, ...])

return_MP4_video_level(fname, /, *[, ...])

return_MP4_video_profile(fname, /, *[, ...])

return_audio_bit_rate(fname, /, *[, ...])

Return the bit rate of the first audio stream in the media file.

return_audio_channels(fname, /, *[, ...])

return_audio_format(fname, /, *[, cacheDir, ...])

Return the format of the first audio stream in a media file

return_audio_sample_rate(fname, /, *[, ...])

return_dict_of_ISO_audio_streams(fname, /, *)

return_dict_of_ISO_subtitle_streams(fname, /, *)

return_dict_of_ISO_tracks(fname, /, *[, ...])

return_dict_of_bluray_playlists(dname, /, *)

This function uses the list of MPLS files to obtain all of the possible playlists in a Blu-ray, then it calls "ffprobe" on each integer to determine the duration and size.

return_dict_of_bluray_playlistsToStreams(...)

This function uses the list of MPLS files to obtain all of the possible playlists in a Blu-ray, then it calls "parse_MPLS_file" on each file to determine the duration.

return_dict_of_media_audio_streams(fname, /, *)

return_dict_of_media_subtitle_streams(fname, ...)

return_dict_of_media_video_streams(fname, /, *)

return_media_bit_rate(fname, /, *[, ...])

return_media_duration(fname, /, *[, ...])

return_media_format(fname, /, *[, cacheDir, ...])

Return the format of a media file

return_subtitle_bit_rate(fname, /, *[, ...])

Return the bit rate of the first subtitle stream in the media file.

return_subtitle_extent(fname, /, *[, ...])

return_subtitle_format(fname, /, *[, ...])

Return the format of the first subtitle stream in a media file

return_video_bit_depth(fname, /, *[, ...])

return_video_bit_rate(fname, /, *[, ...])

Return the bit rate of the first video stream in the media file.

return_video_crop_parameters(fname, /, *[, ...])

return_video_display_aspect_ratio(fname, /, *)

return_video_format(fname, /, *[, cacheDir, ...])

Return the format of the first video stream in a media file

return_video_frame_rate(fname, /, *[, ...])

return_video_height(fname, /, *[, cacheDir, ...])

return_video_pixel_aspect_ratio(fname, /, *)

return_video_pixel_format(fname, /, *[, ...])

return_video_ratios(fname, /, *[, cacheDir, ...])

return_video_rotation(fname, /, *[, ...])

return_video_size(fname, /, *[, cacheDir, ...])

return_video_source_aspect_ratio(fname, /, *)

return_video_width(fname, /, *[, cacheDir, ...])

return_x264_crf(w, h, /)

return_x264_level(w, h, /)

return_x264_profile(w, h, /)

yuv2rgb(im, /, *[, version])

Convert array-like YUV image to RGB colourspace