关于Cannot find installation of real FFmpeg (which comes with ffprobe)问题

遇到Cannot find installation of real FFmpeg (which comes with ffprobe)问题
目标,将视频水平翻转
以下是代码

import os
# 要点,要避免出现‘Cannot find installation of real FFmpeg (which comes with ffprobe)‘
# 在import skvideo.io之前,先skvideo.setFFmpegPath('ffmpeg所在的文件位置')
import skvideo
skvideo.setFFmpegPath('D:/INSTALLER/ffmpeg-5.0.1-essentials_build/bin')
import skvideo.io
import cv2

if __name__ == '__main__':
    originvideo_file = 'D:/VIDEOS/running on treadmill/'
    videos_file_names = os.listdir(originvideo_file)
    # 1. 左右镜像翻转视频
    for file_name in videos_file_names:
        video_path = '{}{}'.format(originvideo_file, file_name)

        name_without_suffix = file_name.split('.')[0]
        outvideo_path = '{}{}_mirror.mp4'.format(originvideo_file, name_without_suffix)

        writer = skvideo.io.FFmpegWriter(outvideo_path)
                                         # outputdict={'-f': 'mp4', '-vcodec': 'libx264', '-r': '30'})
        reader = skvideo.io.FFmpegReader(video_path)
        for frame in reader.nextFrame():
            frame_mirror = cv2.flip(frame, 1)
            writer.writeFrame(frame_mirror)
        writer.close()
        print('{} mirror success'.format(file_name))

    print('the video in are all mirrored')
    print('-------------------------------------------------------')

你可能感兴趣的:(视频处理,python)