我想在python脚本中运行此命令
cmd = 'ffmpeg -ss ' + start_time + ' -i remove_takeoff.mp4 -filter_complex "[0]trim=0,setpts=PTS-STARTPTS[b];[b][0]overlay=shortest=1" -shortest -c:a trimmed_takeoff.mp4'
我正在使用以下代码段
import subprocess
import shlex
cmd = # the command
suprocess.call(shlex.split(cmd))
我遇到以下错误
Trailing options were found on the commandline.
发生上述错误是因为shlex.split命令将零件的双引号转换为单引号。如何避免这种情况的发生。谁能建议我解决这个问题的方法。
检查下面的完整错误跟踪。
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.2 (GCC) 20140120 (Red Hat 4.8.2-15)
configuration: --prefix=/home/vkv/anaconda3
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Trailing options were found on the commandline.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'remove_takeoff.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.67.100
Duration: 00:00:14.00, start: 0.000000, bitrate: 15883 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 15881 kb/s, 20 fps, 20 tbr, 10240 tbn, 40 tbc (default)
Metadata:
handler_name : VideoHandler
Filter overlay has an unconnected output