FFMPEG 输入中的空格阻碍执行

Spaces in FFMPEG Input Thwart Execution

令人困惑的是,为什么 spaces 在音频输入中似乎工作正常,但 spaces 在视频输入中却出了问题。 这从目录中获取随机图像,将它们与随机音频剪辑配对并将它们加入 mp4 视频。

def makeAudioImgMovs():
    randImgs = getImgs()
    compAudClips = makeAudioClips()
    audioJpgs = dict(zip(randImgs,compAudClips)) #Heres where we join the completed audio clips and the jpgs into a dict
    for jpg, aud in audioJpgs.items():
        print(f'The img is {jpg}, the type of the img is {type(jpg)} the aud is {aud} the type of the aud is {type(aud)}')
        subprocess.call('ffmpeg -hide_banner -loglevel error -loop 1 -i "{0}" -i "{1}"\
        -filter:v \
        "fade=in:st=0:d=1, fade=out:st=10:d=1,scale=720:480:force_original_aspect_ratio=decrease,pad=720:480:(ow-iw)/2:(oh-ih)/2,setsar=1" \
         -filter:a "afade=in:st=0:d=1, afade=out:st=10:d=1" \
        -c:v libx264 -t 11 -pix_fmt yuv420p -preset faster -shortest -c:a aac {2}.mp4'.format(jpg,aud,timePath/(pathlib.Path(jpg).stem)),shell=True)
makeAudioImgMovs()

打印语句正在写入 audioJpgs 列表的字典中的内容。例如...

img 是 2021-09-02-1-40/ponty_me.jpg,img 的类型是 aud 是 2021-09-02 -1-40/Jms Brn like it is like it was.aiff aud 的类型是

img 是 2021-09-02-1-40/1966taxiToMassFromMomBack 2.tiff,img 的类型是 aud 是 2021-09- 02-1-40/Lola_Fay.mp3 音频类型是

[NULL @ 0x7fe503021400] 无法为“2021-09-02-1-40/1966taxiToMassFromMomBack”找到合适的输出格式 2021-09-02-1-40/1966taxiToMassFromMomBack:参数无效

img 是 2021-09-02-1-40/1966taxiToMassFromMomBack 5.tiff,img 的类型是 aud 是 2021-09- 02-1-40/M Miller Lonnie's Lament.aiff 澳元的类型是

[NULL @ 0x7fd32a854c00] 无法为“2021-09-02-1-40/1966taxiToMassFromMomBack”找到合适的输出格式 2021-09-02-1-40/1966taxiToMassFromMomBack:参数无效

img 是 2021-09-02-1-40/10_021390_danny? 1_jpg.jpg,img 的类型是 aud 是 2021-09-02-1-40/i_got_to_rock.mp3 aud 的类型是

[NULL @ 0x7f8449835800] 无法为“2021-09-02-1-40/10_021390_danny”找到合适的输出格式? 2021-09-02-1-40/10_021390_danny?: 参数无效

img 是 2021-09-02-1-40/11_021390_danny_2_jpg.jpg,img 的类型是 aud 是 2021-09-02 -1-40/M Miller Power.aiff aud 的类型是

最后一对img/aud完成的很好,写了一个mp4。请注意,音频文件中有 spaces! 请注意,在 jpg 文件名中有 space 的地方会抛出错误 'Invalid argument'。

非常感谢帮助。

这里需要用双引号:

ffmpeg ... -c:a aac "{2}.mp4"