Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在视频中用image/numpy数组替换帧?_Python_Video_Ffmpeg - Fatal编程技术网

Python 如何在视频中用image/numpy数组替换帧?

Python 如何在视频中用image/numpy数组替换帧?,python,video,ffmpeg,Python,Video,Ffmpeg,我试过这个: 写视频 但它不起作用。定义它不起作用。在什么情况下你会使用上面的内容,你希望它能做什么?我在一个视频隐写代码中使用这个。我正在做的是从视频中读取一帧(720*1280*3)作为一个numpy数组。然后在其中隐藏一条消息(即更改其中的一些位)。之后,我想把视频中的帧替换为具有隐藏消息的帧。 command = [ FFMPEG_BIN, '-y', # (optional) overwrite output file if it exists

我试过这个:

写视频
但它不起作用。

定义
它不起作用。在什么情况下你会使用上面的内容,你希望它能做什么?我在一个视频隐写代码中使用这个。我正在做的是从视频中读取一帧(720*1280*3)作为一个numpy数组。然后在其中隐藏一条消息(即更改其中的一些位)。之后,我想把视频中的帧替换为具有隐藏消息的帧。
command = [ FFMPEG_BIN,
            '-y', # (optional) overwrite output file if it exists
            '-f', 'rawvideo',
            '-vcodec','rawvideo',
            '-s', 'hd720', # size of one frame
            '-pix_fmt', 'rgb24',
            '-r', '15', # frames per second
            '-i', '-', # The input comes from a pipe
            '-an', # Tells FFMPEG not to expect any audio
        '-vcodec', 'mpeg',              
            'vidfl_test.mp4' ]
pipe = sp.Popen( command, stdin=sp.PIPE, stderr=sp.PIPE)
pipe.stdin.write(image.tostring())