ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

How do I add a custom thumbnail to a .mp4 file using ffmpeg-python

Open alexagit85 opened this issue 5 years ago • 2 comments

how to do this with ffmpeg-python

ffmpeg -i video.mp4 -i image.png -map 1 -map 0 -c copy -disposition:0 attached_pic out.mp4

or

ffmpeg -i in.mp4 -i IMAGE -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic out.mp4

find the proper ffmpeg command to add a .png or .jpg image to a .mp4 video as a thumbnail with ffmpeg-library

thanks

alexagit85 avatar Jun 08 '20 19:06 alexagit85

(
    ffmpeg
    .output(video, audio, 'out.mp4', c='copy', **{'c:v:1': 'png'}, **{'disposition:v:1': 'attached_pic'})
    .global_args('-map', '0')
    .global_args('-map', '1')
    .global_args('-loglevel', 'error')
    .run()
)

Cioscos avatar Jul 13 '20 15:07 Cioscos

thanks its working

import ffmpeg

stream = ffmpeg.input('test.mp4')
thumbnail = ffmpeg.input('test.png')

(
    ffmpeg
    .output(stream, thumbnail, 'test_thumbnail.mp4', c='copy', **{'c:v:1': 'png'}, **{'disposition:v:1': 'attached_pic'})
    .global_args('-map', '0')
    .global_args('-map', '1')
    .run()
)

irfanykywz avatar Dec 25 '23 00:12 irfanykywz