kkroening / ffmpeg-python

Python bindings for FFmpeg - with complex filtering support
Apache License 2.0
9.89k stars 885 forks source link

convert frame buffer raw image to *.PNG image #395

Open MBorto opened 4 years ago

MBorto commented 4 years ago

Hello everyone, I'm new using ffmpeg and also ffmpeg-python library. I've the followig problem:

I'm realizing a little python program wich converts a frame buffer dump to a *.PNG image. Using Linux distribution I was able using command line to have a correct final .png image starting form frame buffer dump (cat /dev/fb0 > fbdump), the command I used is the following.

ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb32 -s 800x480 -i fbdump -f image2 -vcodec png test.png

Now I want replicate this command using ffmpeg-python API's. I've tried with this but it seems not working...

input_data = None
width = 800
height = 480

process = (
        ffmpeg
        .input('fbdump', vcodec= 'rawvideo', f= 'rawvideo', pix_fmt ='rgb32', s = '{}x{}'.format(width, height))
        .output('test.png', f= 'image2', vcodec= 'png')
        .run_async()
    )
    process.communicate(input = input_data)

This application fails sayng test.png isn't available... Someone can help me?

samiashi commented 4 years ago

@MBorto I was able to correctly convert a frame buffer dump to a PNG using your Python script above. Can you provide the full stacktrace you're getting?