Skip to main content

A MediaSwift PYTHON PACKAGE FOR MEDIA CONVERSION PLAY AND PROBING.

Project description

MediaSwift ⇨ 🚀 EMPOWERING PYTHON WITH ADVANCED MULTIMEDIA OPERATION'S.

License

MediaSwift : A POWERFUL PYTHON LIBRARY FOR SEAMLESS MULTIMEDIA OPERATIONS , MediaSwift SIMPLIFIES COMPLEX TASKS, MAKING IT EASY TO INTEGRATE AND ENHANCE YOUR MULTIMEDIA APPLICATIONS. DIVE INTO THE FUTURE OF MEDIA HANDLING WITH MediaSwift YOUR GO-TO LIBRARY FOR 2024 .

KEY FEATURES :

  • EFFORTLESS FILE CONVERSION .
  • SEAMLESS MULTIMEDIA PLAYBACK .
  • PROVIDING INFORMATION MediaSwift ALSO OFFERS DETAILED MULTIMEDIA INFORMATION RETRIEVAL .

EXPLORE THE CAPABILITIES OF MediaSwift AND ELEVATE YOUR PYTHON MULTIMEDIA PROJECTS WITH SIMPLICITY AND EFFICIENCY.

  • SUPPORTED VIDEO CODEC'S :

    h264, libx264, mpeg4, vp9, av1, hevc, mjpeg, H.265 / HEVC, VP8, VP9, AV1, VC1, MPEG1, MPEG2, H.263, Theora, MJPEG, MPEG-3, MPEG-4 . . .

  • SUPPORTED AUDIO CODEC'S :

    aac, mp3, opus, vorbis, pcm, alac, flac, wv, ape, mka, opus, ac3, eac3, alac . . .

  • SUPPORTED FILE EXTENSION'S :

    VIDEO FORMATS : .mp4, .avi, .mkv, .webm, .mov, .wmv, .webm, .flv, .mov, .wmv, .hevc, .prores, .dv . . .

AUDIO FORMATS : .mp3, .aac, .ogg, .wav, .flac, .flac, .m4a, .ogg, .wv, .ape, .mka, .opus, mpc, .tak, .alac . . .

  • SUPPORTED HARDWARE ACCELERATION :

    HARDWARE ACCELERATION : cuda, dxva2, qsv, d3d11va . . .

❗IMPORTANT NOTE:

  • THEY ALSO SUPPORT HARDWARE ACCELERATION FOR MEDIA FILE CONVERTION .

  • SUPPORT DOLBY DIGITAL PLUS AND DOLBY DIGITAL AUDIO CODEC .eac3, .ac3 .

  • SUPPORT MORE VIDEO AND AUDIO CODECS AND VARIOUS EXTENSION FORMATE'S .

  • MediaSwift: A VERSATILE LIBRARY WITH MANY SUPPORT AUDIO AND VIDEO CODECS, AS WELL AS MULTIPLE FILE FORMATS EXTENSION .

  • LIST THE AVAILABLE .CODEC'S(), .FORMATE'S() AND .HWACCEL'S() :

from MediaSwift import *

INFO = ffpe()

print(INFO.codecs())
print(INFO.formats())
print(INFO.hwaccels())

# GET CODECS ENCODING
print(INFO.codecs(encoder='aac'))
  • ENHANCE COMPATIBILITY BY LEVERAGING THE .formats(), .codecs() .hwaccels() AND METHODS TO VALIDATE SUPPORT FOR A VARIETY OF FORMATS, CODECS AND HARDWARE ACCELERATION .

  • GET INFORMATION ABOUT THE CODEC'S ENCODER .codecs(encoder="aac") .

  • CHECK LIBRARY VERSION USING :

from MediaSwift import *

# GET AND PRINT AUTHOR INFORMATION
AUTHOR_INFO = author()
print(AUTHOR_INFO)

# GET AND PRINT VERSION INFORMATION
VERSION_INFO = version()
print(VERSION_INFO)
  • EFFICIENT MEDIA PLAYBACK WITH ffpl .

THE ffpl CLASS PROVIDES METHODS FOR PLAY MEDIA FILES. HERE ARE SOME EXAMPLES OF HOW TO USE THESE METHOD:

from MediaSwift import *

# INCREASE VOLUME BY 5 DB
PLAY = ffpl()
MEDIA_FILE = r"PATH_TO_MEDIA_FILE"                                        # PLAY SINGE MEDIA FILE
MEDIA_FILE = r"PATH_TO_MEDIA_FILE_1", r"PATH_TO_MEDIA_FILE_2"             # PLAY MULTIPLE MEDIA FILE

# USE noborder=True TO REMOVE PLAYER WINDOW BORDER.
print(PLAY.play(MEDIA_FILE, volume=5, noborder=True))
print(PLAY.play_multiple(MEDIA_FILE ,volume=5, noborder=True))

NOTE: USE THE .play() METHOD TO PLAY MEDIA FILES .

noborder=True ARGUMENT TO ELIMINATE THE BORDER OF THE PLAYER WINDOW . volume=True TO AMPLIFY THE AUDIO OUTPUT IN DECIBELS .

  • ANALYZE MEDIA FILE ffpr.

THE ffpr CLASS PROVIDES METHODS FOR PROBING MEDIA FILES. HERE ARE SOME EXAMPLES OF HOW TO USE THESE METHODS :

from MediaSwift import ffpr

DETAILS = ffpr()
INFO = DETAILS.probe(r"PATH_TO_INPUT_FILE")

print(DETAILS.analyze(INFO))

# ENHANCE THE APPEALING CONTENT USING 'pretty=True'.
print(DETAILS.analyze(INFO, pretty=True))

SUBSTITUTE "PATH_TO_INPUT_FILE" WITH THE ACTUAL FILE PATH TO YOUR MEDIA FILE. THE .probe METHOD RETURNS A DICTIONARY CONTAINING DETAILED INFORMATION ABOUT THE MEDIA FILE. WHEN USING pretty=True, THE CONTENT IS DISPLAYED IN A MORE VISUALLY APPEALING FORMAT.

SPECIFY pretty=True TO DISPLAY THE INFORMATION IN A VISUALLY ENHANCED FORMAT.

  • CONVERT MEDIA FILE ffpe.

ffpe CLASS PROVIDES METHODS FOR VIDEO CONVERSION, LISTING CODECS, AND LISTING FORMATS. HERE ARE SOME EXAMPLES OF HOW TO USE THESE METHODS :

EXAMPLE ⇨ CONVERT SINGLE VIDEO USING THIS :

from MediaSwift import ffpe

FFMPL = ffpe()

FFMPL.convert(
    input_files = r"PATH_TO_INPUT_FILE" ,         # INPUT FILE PATH
    output_dir =  r"PATH_TO_OUTPUT_FOLDER" ,      # OUTPUT PATH
    cv='h264',        # VIDEO CODEC
    ca='aac',         # AUDIO CODEC
    s='1920x1080',    # VIDEO RESOLUTION
    hwaccel='cuda',   # HARDWARE ACCELERATION
    ar=44100,         # AUDIO SAMPLE RATE
    ac=2,             # AUDIO CHANNELS
    ba='192k',        # AUDIO BITRATE
    r=30,             # VIDEO FRAME RATE
    bv='50m',         # VIDEO BITRATE
    preset='fast',    # PRESET FOR ENCODING
    f='mp4',          # OUTPUT FORMAT

)

EXAMPLE ⇨ CONVERT MULTIPLE VIDEO USING THIS : ⇨ NOTE : ALWAYS SET INPUT FILE PATH IN SQUARE '[ ]' BRACKETS:

from MediaSwift import ffpe

FFPE_INSTANCE = ffpe()

INPUT_FILES = [
    r"PATH_TO_INPUT_FILE",
    r"PATH_TO_INPUT_FILE",
    # ADD MORE FILE PATHS AS NEEDED
]                                                           # INPUT_FILES [MULTIPLE CONVERT]
INPUT_FILES =  r'PATH_TO_INPUT_FILE'                        # INPUT_FILES [SINGLE CONVERT]
OUTPUT_DIR =   r"PATH_TO_OUTPUT_FOLDER"

FFPE_INSTANCE.convert(
    input_files = INPUT_FILES, # INPUT FILE PATH
    output_dir = OUTPUT_DIR,   # OUTPUT PATH
    cv='h264',        # VIDEO CODEC
    ca='aac',         # AUDIO CODEC
    s='1920x1080',    # VIDEO RESOLUTION
    hwaccel='cuda',   # HARDWARE ACCELERATION
    ar=44100,         # AUDIO SAMPLE RATE
    ac=2,             # AUDIO CHANNELS
    ba='192k',        # AUDIO BITRATE
    bv='50m',         # VIDEO BITRATE
    preset='fast',    # PRESET FOR ENCODING
    r=30,             # VIDEO FRAME RATE
    f='mp4',          # OUTPUT FORMAT
)

EXAMPLE ⇨ CONVERT MULTIPLE VIDEO INTO AUDIO FILE USING THIS :

from MediaSwift import ffpe
FFPE_INSTANCE = ffpe()

# DEFINE INPUT FILES AND OUTPUT DIRECTORY.
INPUT_FILES = [ r'PATH_TO_INPUT_FILE', r'PATH_TO_INPUT_FILE' ]     # INPUT_FILES [MULTIPLE CONVERT]
INPUT_FILES =   r'PATH_TO_INPUT_FILE'                              # INPUT_FILES [SINGLE CONVERT]

OUTPUT_DIR =  r"PATH_TO_OUTPUT_FOLDER"

# PERFORM MULTIMEDIA FILE CONVERSION USING FFPE.
FFPE_INSTANCE.convert(
    input_files=INPUT_FILES,
    output_dir=OUTPUT_DIR ,
    hwaccel="cuda",   # HARDWARE ACCELERATION
    ar=44100,         # AUDIO SAMPLE RATE
    ac=2,             # AUDIO CHANNELS
    ba="192k",        # AUDIO BITRATE
    f="mp3",          # OUTPUT FORMAT (MP3 for audio)
)

⇨ NOTE : USE THE .convert() METHOD TO CONVERT MEDIA FILES .

NOTE ⇨ ALWAYS SET MULTIPLE INPUT_FILES PATH IN SQUARE '[ ]' BRACKETS:

from MediaSwift import *

CONVERTER = ffpe()
INPUT_FILE = r"PATH_TO_INPUT_FILE"  # INPUT FILE
OUTPUT_FILE = r"PATH_TO_INPUT_FILE"  # OUTPUT FILE
TIME_RANGE = "01:30,02:30"  # CLIP FROM 1 MINUTE 30 SECONDS TO 2 MINUTES 30 SECONDS

CONVERTER.MediaClip(INPUT_FILE, OUTPUT_FILE, TIME_RANGE)

NOTE : USE THE .MediaClip() METHOD TO EXTRACTS SPECIFIC PART OF VIDEO AND CONVERTS IT INTO GIF.

  • 🔎 IMPORT CLASSES AND MODULE :

from MediaSwift import ffpe, ffpl, ffpr
from MediaSwift import *
  • ⚙️ INSTALLATION :

pip install MediaSwift
  • 😃 AUTHOR INFORMATION :

THIS PYTHON LIBRARY PROJECT IS DONE BY ROHIT SINGH . FOR ANY QUERIES TO CHECK MY GITHUB, THANK YOU FOR USING MediaSwift PYTHON LIBRARY,LIBRARY RELEASE IN 2024 .

GitHub Profile

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mediaswift-2.4.2.tar.gz (65.0 MB view details)

Uploaded Source

Built Distribution

MediaSwift-2.4.2-py3-none-any.whl (65.0 MB view details)

Uploaded Python 3

File details

Details for the file mediaswift-2.4.2.tar.gz.

File metadata

  • Download URL: mediaswift-2.4.2.tar.gz
  • Upload date:
  • Size: 65.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for mediaswift-2.4.2.tar.gz
Algorithm Hash digest
SHA256 973921b303be342cee37c2b9bce1cfef0ed0468eb680696158a59f73da0f4c4f
MD5 4e0df5dea48358ee326fe9207e2de67a
BLAKE2b-256 fd4011400af9dfdb2f6f4f5f243706c1b857ed9cab62db9b1a5d785d6fef6896

See more details on using hashes here.

File details

Details for the file MediaSwift-2.4.2-py3-none-any.whl.

File metadata

  • Download URL: MediaSwift-2.4.2-py3-none-any.whl
  • Upload date:
  • Size: 65.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for MediaSwift-2.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 44bb84ef976f8bc197823ab09c0ec6050a146c0889ad1d3de5f9faf7e7e3ed96
MD5 8bd7b7655c87c77b3c9b6ac2fbbf2dc4
BLAKE2b-256 f34b872ec3007e1109235161d0f6b5725fbb16b967b05080e7c4d6195796d7c0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page