<p>Generate the poster frame in the same command:</p>
<p><code>ffmpeg -i input.mp4 -ss 1.2 -i input.mp4 -map 0 -map 1:v:0 -c copy -c:v:1 png -filter:v:1 trim=end_frame=1,setpts=0 -fps_mode:v:1 passthrough -disposition:v:1 attached_pic output.mp4</code></p>

CC BY-SA 4.0
2024-04-29T05:33:48.497Z
Thanks, that works with ffmpeg 6.1.1 with .mp4 and .m4v.

But that does not work with .mov: macOS 14 QuickTime Player.app displays the old Poster Frame and exiftool does not report any ItemList:CoverArt in the output .mov. With .mov input and .mp4 or .m4v output it works. Apple's Compressor.app 4.7 can insert Poster Frame also to the re-encoded .mov but that is lossy.

p.s. thanks for the info about that workflow with ffmpeg. I am still curious how to pipe such commands. My attempts to do so produced at best only the output of the 1st command, which I could not pipe to the 2nd command.
wywh
CC BY-SA 4.0
2024-04-29T20:14:21.517Z
A workaround for .mov is to extract .png and insert it with exiftool: 
`ffmpeg -ss 1.2 -i input.mov -frames:v 1 image-%03d.png` and `exiftool -P -overwrite_original '-CoverArt<=image-001.png' input.mov` With 4K 10-bit HLG .mov the exported .png might be too large (~44 MB) but that should be patched in exiftool 12.85. Is it possible to reduce the size ffmpeg exports? Or maybe use .jpg instead? [link](https://exiftool.org/forum/index.php?topic=16001.msg86032#msg86032)
wywh
CC BY-SA 4.0
2024-04-30T08:39:35.527Z
png bloats the movie so it might be better to use 'mjpeg' instead 'png' in the Gyan's and my commands above. For example, in one movie the 44 MB 3840x2160 Deep Color png could be substituted by just 0.5 MB 3840x2160 True color jpg. Apple's Compressor 4.7 also uses .jpg in its CoverArt Poster Frames.
wywh
CC BY-SA 4.0
2024-04-28T17:35:27.450Z
2024-04-28T17:35:27.450Z
Gyan
<p>I can export a frame as .png from, say 1.2 seconds from the beginning of the movie (=1 second and 5 or 6 frames with 25 or 30 fps input):</p>
<pre><code>ffmpeg -ss 1.2 -i input.mp4 -frames:v 1 image.png
</code></pre>
<p>And then losslessly use that .png as a custom Poster Frame in that movie:</p>
<pre><code>ffmpeg -i input.mp4 -i image.png -map 0 -map 1 -c copy -disposition:v:1 attached_pic output.mp4
</code></pre>
<p>Question: how can I pipe those two commands together?</p>

<ffmpeg>
Add custom Poster Frame to a movie with ffmpeg by combining two commands with a pipe
wywh
# Add custom Poster Frame to a movie with ffmpeg by combining two commands with a pipe

(Asked by: username_0 on 2024-04-28)

I can export a frame as .png from, say 1.2 seconds from the beginning of the movie (=1 second and 5 or 6 frames with 25 or 30 fps input):
ffmpeg -ss 1.2 -i input.mp4 -frames:v 1 image.png

And then losslessly use that .png as a custom Poster Frame in that movie:
ffmpeg -i input.mp4 -i image.png -map 0 -map 1 -c copy -disposition:v:1 attached_pic output.mp4

Question: how can I pipe those two commands together?

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2024-04-28. Score: 0

Generate the poster frame in the same command:

`ffmpeg -i input.mp4 -ss 1.2 -i input.mp4 -map 0 -map 1:v:0 -c copy -c:v:1 png -filter:v:1 trim=end_frame=1,setpts=0 -fps_mode:v:1 passthrough -disposition:v:1 attached_pic output.mp4`

> **Comments:**
> **username_0**: Thanks, that works with ffmpeg 6.1.1 with .mp4 and .m4v.  But that does not work with .mov: macOS 14 QuickTime Player.app displays the old Poster Frame and exiftool does not report any ItemList:CoverArt in the output .mov. With .mov input and .mp4 or .m4v output it works. Apple's Compressor.app 4.7 can insert Poster Frame also to the re-encoded .mov but that is lossy.  p.s. thanks for the info about that workflow with ffmpeg. I am still curious how to pipe such commands. My attempts to do so produced at best only the output of the 1st command, which I could not pipe to the 2nd command.  
> **username_0**: A workaround for .mov is to extract .png and insert it with exiftool:  `ffmpeg -ss 1.2 -i input.mov -frames:v 1 image-%03d.png` and `exiftool -P -overwrite_original '-CoverArt<=image-001.png' input.mov` With 4K 10-bit HLG .mov the exported .png might be too large (~44 MB) but that should be patched in exiftool 12.85. Is it possible to reduce the size ffmpeg exports? Or maybe use .jpg instead? [link](https://exiftool.org/forum/index.php?topic=16001.msg86032#msg86032)  
> **username_0**: png bloats the movie so it might be better to use 'mjpeg' instead 'png' in the username_1's and my commands above. For example, in one movie the 44 MB 3840x2160 Deep Color png could be substituted by just 0.5 MB 3840x2160 True color jpg. Apple's Compressor 4.7 also uses .jpg in its CoverArt Poster Frames.  

---

