Skip to content

ffmpeg video filter vf with imageio-ffmpeg #103

@sugizo

Description

@sugizo

objective
use ffmpeg video filter vf with imageio-ffmpeg

code

from imageio_ffmpeg import read_frames, write_frames

output_file = 'magma.mp4'

reader = read_frames(video_file)
meta = reader.__next__()

writer = write_frames(output_file, audio_path = video_file,
                      size = meta['size'], fps = meta['fps'],
                      input_params = ['-y', ],
                      output_params = ['-r', fps_v, 
                                       '-vf', "[v0]pseudocolor = preset = magma[v1]", ] )
writer.send(None)

for frame in reader:
    writer.send(frame)

writer.close()

result

BrokenPipeError                           Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/imageio_ffmpeg/_io.py](https://localhost:8080/#) in write_frames(path, size, pix_fmt_in, pix_fmt_out, fps, quality, bitrate, codec, macro_block_size, ffmpeg_log_level, ffmpeg_timeout, input_params, output_params, audio_path, audio_codec)
    626             try:
--> 627                 p.stdin.write(bb)
    628             except Exception as err:

BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
1 frames
[/usr/local/lib/python3.10/dist-packages/imageio_ffmpeg/_io.py](https://localhost:8080/#) in write_frames(path, size, pix_fmt_in, pix_fmt_out, fps, quality, bitrate, codec, macro_block_size, ffmpeg_log_level, ffmpeg_timeout, input_params, output_params, audio_path, audio_codec)
    632                     "OUTPUT:\n".format(err, cmd_str)
    633                 )
--> 634                 raise IOError(msg)
    635 
    636             nframes += 1

OSError: [Errno 32] Broken pipe

FFMPEG COMMAND:
/usr/local/lib/python3.10/dist-packages/imageio_ffmpeg/binaries/ffmpeg-linux64-v4.2.2 -y -f rawvideo -vcodec rawvideo -s 640x368 -pix_fmt rgb24 -r 10.00 -y -i - -i merge_audio_ffmpeg.mp4 -vcodec libx264 -pix_fmt yuv420p -crf 25 -v warning -r 10 -vf [v0]pseudocolor = preset = magma[v1] -map 0:v:0 -map 1:a:0 magma.mp4

FFMPEG STDERR OUTPUT:

best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions