Problem in setting video thumbnail with ffmpeg - ffmpeg

I'm trying to add thumbnail to a mkv video with the following command: ffmpeg -y -i video.mkv -i image.jpg -map 1 -map 0 -c copy -disposition:0 attached_pic out.mkv. However this command replaces all frames in the video with that image and no sound. Am I doing something wrong. I'm using latest version of ffmpeg.

What you tried works for MP4 file and not for MKV file. Try this:
ffmpeg -y -i video.mkv -i image.jpg \
-attach image.jpg -metadata:s:t mimetype=image/jpeg \
-c copy out.mkv

Related

ffmpeg add video thumbnail only [duplicate]

I am trying to find the proper ffmpeg command to add a .png or .jpg image to a .mp4 video as a thumbnail. The command will eventually automatically be executed by a C# program.
This is what I have so far:
# This does not work. It only removes the default thumbnail.
ffmpeg -i video.mp4 -i image.png -acodec copy -vcodec copy -map 0 -map 1:0 OUTPUT.mp4
Is what I want possible with ffmpeg? If so, please guide me in the right direction.
Using ffmpeg 4.0, released Apr 20 2018 or newer,
ffmpeg -i video.mp4 -i image.png -map 1 -map 0 -c copy -disposition:0 attached_pic out.mp4
As in version 4.2.2...See Section 5.4 in FFmpeg documentation
To add an embedded cover/thumbnail:
ffmpeg -i in.mp4 -i IMAGE -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic out.mp4
Not all muxers support embedded thumbnails, and those who do, only support a few formats, like JPEG or PNG.

FFMPEG picture in picture and watermark

I'm trying to take create a picture in picture effect with 2 videos and add a watermark with 1 command. Here's what I have so far, it works great, except the watermark is on the picture in picture video, not the main background video. How do I make the watermark on the main video?
ffmpeg -y -i pip.mp4 -i main.mp4 -i logo.png -filter_complex \
"[0]scale=iw/4:-1[pip]; \
[pip][2]overlay=10:10[watermark]; \
[1][watermark]overlay=main_w-overlay_w-10:main_h-overlay_h-10" output.mp4
Rearrange your labels:
ffmpeg -y -i pip.mp4 -i main.mp4 -i logo.png -filter_complex \
"[0]scale=iw/4:-1[pip]; \
[1][pip]overlay=10:10[watermark]; \
[watermark][2]overlay=main_w-overlay_w-10:main_h-overlay_h-10" output.mp4

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

I am trying to find the proper ffmpeg command to add a .png or .jpg image to a .mp4 video as a thumbnail. The command will eventually automatically be executed by a C# program.
This is what I have so far:
# This does not work. It only removes the default thumbnail.
ffmpeg -i video.mp4 -i image.png -acodec copy -vcodec copy -map 0 -map 1:0 OUTPUT.mp4
Is what I want possible with ffmpeg? If so, please guide me in the right direction.
Using ffmpeg 4.0, released Apr 20 2018 or newer,
ffmpeg -i video.mp4 -i image.png -map 1 -map 0 -c copy -disposition:0 attached_pic out.mp4
As in version 4.2.2...See Section 5.4 in FFmpeg documentation
To add an embedded cover/thumbnail:
ffmpeg -i in.mp4 -i IMAGE -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic out.mp4
Not all muxers support embedded thumbnails, and those who do, only support a few formats, like JPEG or PNG.

FFmpeg | Option loop not found

The loop option is not working with gif image.
When I'm working with png image the code good.
But when I'm working with animated gif image the error is thrown Option loop not found.
In my example I'm trying to create the video from input image with specific duration.
ffmpeg -loop 1 -t 5 -i 15324210315b56e3a78abe5.png -i watermark.png -filter_complex "[0]scale=trunc(iw/2)*2:trunc(ih/2)*2[v];[v][1]overlay=x=(W-w-10):y=(H-h-10)" output.mp4
Below command is not working
ffmpeg -loop 1 -t 5 -i 15323488345b55c9a2b2908.gif -i watermark.png -filter_complex "[0]scale=trunc(iw/2)*2:trunc(ih/2)*2[v];[v][1]overlay=x=(W-w-10):y=(H-h-10)" output.mp4
GIFs are handled by a seperate demuxer module, not the generic image sequence demuxer. The gif demuxer has a separate option. See command below.
ffmpeg -ignore_loop 0 -t 5 -i 15323488345b55c9a2b2908.gif ...
The python script for gif to video conversion using ffmpeg library
f"/opt/ffmpeglib/ffmpeg -ignore_loop 0 -i {lambda_file_path} -c:v libx264 -t 10 -pix_fmt yuv420p {lambda_output_file_path}

Adding more than one image in front of video in ffmpeg

I'm using this command to put image in fromt of video in ffmpeg:
ffmpeg -re -i input -i myimage -filter_complex "overlay=10:10" -f mpegts udp://127.0.0.1:port
I need to put another image in differant position but on the same video, is there any way to do it ?
You would use
ffmpeg -re -i input -i image1 -i image2 \
-filter_complex "[0][1]overlay=10:10[a];[a][2]overlay=W-10:10" \
-f mpegts udp://127.0.0.1:port

Resources