Skip to content

Commit

Permalink
[FIX] - Correção da função de extrair ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
otavio-code authored Jan 26, 2025
1 parent 65c24cf commit 2b8737e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/src/service/ffmpeg_extract_frames.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import subprocess
import tarfile
import boto3
from app.src.config.config import logger

Expand All @@ -9,13 +10,15 @@
FFMPEG_LOCAL_PATH = '/tmp/ffmpeg-release-amd64-static.tar.xz'
FFMPEG_BIN_PATH = '/tmp/ffmpeg'

def download_ffmpeg():
logger.info(f"Baixando FFmpeg do S3: s3://{S3_BUCKET}/{FFMPEG_S3_KEY}")
s3.download_file(S3_BUCKET, FFMPEG_S3_KEY, FFMPEG_LOCAL_PATH)
logger.info("Extraindo FFmpeg...")
subprocess.run(['tar', '-xJf', FFMPEG_LOCAL_PATH, '-C', '/tmp', '--strip-components', '1'], check=True)
import tarfile

def extract_ffmpeg():
logger.info("Extraindo FFmpeg usando tarfile...")
with tarfile.open(FFMPEG_LOCAL_PATH, 'r:xz') as tar:
tar.extractall(path='/tmp')
logger.info("FFmpeg extraído com sucesso.")


def extract_frames_with_ffmpeg(video_path, output_dir):
"""
Extrai frames de um vídeo usando FFmpeg.
Expand Down

0 comments on commit 2b8737e

Please sign in to comment.