Mi comando ffmpeg
command = f"ffmpeg -hwaccel cuda -loglevel error -y -i input.mp4 -filter_complex \"subtitles='subtitles.srt'\" output.mp4"
subprocess.run(command, shell=True)
me da el error
[AVFilterGraph @ 0x5cdf3b4c7980] No option name near 'subtitles.srt'
[AVFilterGraph @ 0x5cdf3b4c7980] Error parsing a filter description around:
[AVFilterGraph @ 0x5cdf3b4c7980] Error parsing filterchain 'subtitles='subtitles.srt'' around:
Failed to set value 'subtitles='subtitles.srt'' for option 'filter_complex': Invalid argument
Error parsing global options: Invalid argument
Usando esta versión de ffmpeg:
ffmpeg version N-114442-g9df1182065 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
configuration: --enable-libharfbuzz --enable-libfreetype --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-libfreetype
libavutil 59. 7.100 / 59. 7.100
libavcodec 61. 2.100 / 61. 2.100
libavformat 61. 0.100 / 61. 0.100
libavdevice 61. 0.100 / 61. 0.100
libavfilter 10. 0.100 / 10. 0.100
libswscale 8. 0.100 / 8. 0.100
libswresample 5. 0.100 / 5. 0.100
¿Alguna idea de por qué? Parece un problema de comillas, pero exactamente este mismo comando funcionaba con una versión anterior de ffmpeg (sin usar Cuda).
Si desea intentar replicar el problema, este es el código que uso en Google Colab para instalar ffmpeg (tarda unos 24 minutos en ejecutarse):
!apt install nvidia-driver-525
!apt install nvidia-cuda-toolkit
!mkdir ~/nvidia/
%cd ~/nvidia/
!git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
%cd nv-codec-headers
!make install
%cd ~/nvidia/
!git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/
!apt install build-essential yasm cmake libtool libc6 libc6-dev unzip wget libnuma1 libnuma-dev
%cd ~/nvidia/ffmpeg/
!./configure --enable-libharfbuzz --enable-libfreetype --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-libfreetype
!make -j $(nproc)
!ls -l ffmpeg
!./ffmpeg
!sudo make install
!ls -l /usr/local/bin/ffmpeg
!type -a ffmpeg
!echo "$PATH"
!export PATH=$PATH:/usr/local/bin
!echo "$PATH"
%cd /content