insea
insea

Reputation: 3

ffmpeg At least one output file must be specified error

How can i fix this ;( help me.... it works well if i tpye only "'ffmpeg -i ' + video_path + ' -q:v 2 -f image2 ' + frame_path + '\image_%6d.jpg'" on prompt with specific path name. but it doesn't work in .py (i used code in .py-> os.system('ffmpeg -i ' + video_path + ' -q:v 2 -f image2 ' + frame_path + '\image_%6d.jpg')

''' ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 10.2.1 (GCC) 20200726 configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 000002629ef05540] stream 0, timescale not set Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'E:\dataset\Videos\Arrest\Arrest007_x264.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 track : 0 artist : album : date : 0 genre : lyrics : title : encoder : Lavf56.36.100 Duration: 00:01:44.84, start: 0.000000, bitrate: 1499 kb/s Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 1387 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 105 kb/s (default) Metadata: handler_name : SoundHandler Stream #0:2: Video: png, rgb24(pc), 58x38 [SAR 304:261 DAR 16:9], 90k tbr, 90k tbn, 90k tbc (attached pic) At least one output file must be specified '''

Upvotes: 0

Views: 923

Answers (1)

kesh
kesh

Reputation: 5533

Make use of helpful (& more secure) built-in packages/functions:

from os import path
import subprocess as sp

sp.run(['ffmpeg','-i', video_path, 
                 '-q:v','2','-f','image2',
                 path.join(frame_path,'image_%6d.jpg')])

I suspect your call went nuts because of unescaped backslashes in the file paths. subprocess.run essentially avoids that nastiness from making a system call.

Upvotes: 0

Related Questions