Skip to main content

Wrapper para o binário FFmpeg

Project description

ffmpeg-for-python

Wrapper para o binário FFmpeg, permitindo o uso de comandos FFmpeg via Python. Para saber como usar FFmpeg, consulte a documentação no site oficial


conversão básica

from ffmpeg_for_python import FFmpeg, FFmpegExceptions

# Cria uma instância do wrapper FFmpeg
ffmpeg = FFmpeg()
# Caminho do arquivo de entrada e saída
input_video = 'input_video.mp4'
output_video = 'output_video.mkv'

# Define o arquivo de entrada e o arquivo de saída
(ffmpeg
        .overwrite_output  # Sobrescrever se existir
        .input(input_video)  # Vídeo de entrada
        .output(output_video)  # Vídeo final
)

    # Executa o comando FFmpeg e exibe a saída
try:
        ffmpeg.run(capture_output=True)
except FFmpegExceptions as e:
        print("Erro ao executar FFmpeg:", e)

remux audio e video

from ffmpeg_for_python import FFmpeg, FFmpegExceptions
# Cria uma instância do wrapper FFmpeg
ffmpeg = FFmpeg()
# Caminho dos arquivos de entrada e saída
input_video = 'input_video.mp4'
input_audio = 'input_audio.mp4'
output_video = 'output_video.mp4'
# Define os arquivos de entrada e o arquivo de saída
(ffmpeg
        .overwrite_output  # Sobrescrever se existir
        .input(input_video)  # Vídeo de entrada
        .input(input_audio)  # Áudio
        .args(arguments=['-c:a', 'copy', '-c:v', 'copy'])  # Parâmetros de cópia de áudio e vídeo
        .output(output_video)  # Vídeo final
)

# Executa o comando FFmpeg e exibe a saída
try:
        ffmpeg.run(capture_output=True)
except FFmpegExceptions as e:
        print("Erro ao executar FFmpeg:", e)

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

ffmpeg_for_python-0.3.5.tar.gz (90.9 kB view details)

Uploaded Source

Built Distribution

ffmpeg_for_python-0.3.5-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file ffmpeg_for_python-0.3.5.tar.gz.

File metadata

  • Download URL: ffmpeg_for_python-0.3.5.tar.gz
  • Upload date:
  • Size: 90.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for ffmpeg_for_python-0.3.5.tar.gz
Algorithm Hash digest
SHA256 18642123d56565bb67d7496bc1b3ba74915d3a3635d01256a7f75574db25ee6f
MD5 80dfad812a84ec7ba6a8421d49bc8911
BLAKE2b-256 849b2220d2272bffcacc49c5944a916eb9c6b87bad7b72ff9680cf7196b2587d

See more details on using hashes here.

File details

Details for the file ffmpeg_for_python-0.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ffmpeg_for_python-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 29dc341dc54df8fa91c727602f87fdcf02bdce43de1364ce3f4cecfc925a2c96
MD5 621f0b9a423e95bf3572df8040c83951
BLAKE2b-256 6e3edb3790f3625aba98295ace5dd31e6de67256bd2f831f42b1950734d11197

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