<p>If you just want to embed a cover you might consider keeping the result as mp3, for example:</p>

<pre><code>ffmpeg -i original.mp3 -i cover.png -map 0:0 -map 1:0 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" -id3v2_version 3 -write_id3v1 1 result.mp3
</code></pre>

<p>If you are creating mp4's, e.g. for YouTube, then I suggest to split the process to two steps - first create the video movie with no audio track, duration somewhat <em>longer</em> than that of the audio. Then mux the video and audio together with the <code>-shortest</code> option which will truncate the video to the exact duration of audio. In terms of time these two steps will take a tidbit longer than a single pass but your whole workflow will be much simpler and more manageable.</p>

CC BY-SA 4.0
2022-04-18T20:52:11.093Z
Wow that really worked. Isn't that shorter with ffmpeg?
BabyBoy
CC BY-SA 3.0
2015-06-25T13:04:55.400Z
2015-06-25T13:04:55.400Z
avnr
<p>I have potentially millions of HLS streaming videos to create from cover art and mp3s.  Obviously, I'd like to keep the resulting bandwidth to a minimum.  I tried various ffmpeg flags specifically suggested for this task and even some on the apple media segmenter that claimed to put a cover art in each segment(meta-file/meta-type).  I had a lot of problems getting chrome to display the cover art when playing back using HTML5 despite it working in VLC.  I ended up with a working command line like this.</p>

<pre><code>ffmpeg -loop 1 -i 1k_image.jpg -i song_219kbs.mp3 -c:v libx264 -pix_fmt yuv420p  -profile:v baseline -c:a aac -strict experimental -b:a 64k -r 1 -shortest song_64k_2fps_baseline.mp4
</code></pre>

<p>The <code>-pix_fmt</code> and baseline profile seemed to be key.  Can you see anything I am doing that is unnecessary?  Is there a better way of achieving my goal?</p>

<p>Also, I look at several of the commercial cloud transcoding solutions and didn't see how to configure one to do this.  Did I miss the options?</p>

CC BY-SA 3.0
2015-06-20T17:02:38.373Z
Please include the complete console output from your command.
llogan
CC BY-SA 3.0
2015-06-26T05:27:22.143Z
Use `libfdk_aac`.  It has better quality per bitrate than ffmpeg's built-in AAC encoder.  Also, don't forget `-movflags +faststart` to put the MOOV atom at the front of the file (essential for streaming).
Peter Cordes
<video><ffmpeg><transcoding>
ffmpeg stream options for mp3, cover art of mp4
Russell Jernigan
# ffmpeg stream options for mp3, cover art of mp4

(Asked by: username_0 on 2015-06-17)

I have potentially millions of HLS streaming videos to create from cover art and mp3s.  Obviously, I'd like to keep the resulting bandwidth to a minimum.  I tried various ffmpeg flags specifically suggested for this task and even some on the apple media segmenter that claimed to put a cover art in each segment(meta-file/meta-type).  I had a lot of problems getting chrome to display the cover art when playing back using HTML5 despite it working in VLC.  I ended up with a working command line like this.
ffmpeg -loop 1 -i 1k_image.jpg -i song_219kbs.mp3 -c:v libx264 -pix_fmt yuv420p  -profile:v baseline -c:a aac -strict experimental -b:a 64k -r 1 -shortest song_64k_2fps_baseline.mp4

The -pix_fmt and baseline profile seemed to be key.  Can you see anything I am doing that is unnecessary?  Is there a better way of achieving my goal?
Also, I look at several of the commercial cloud transcoding solutions and didn't see how to configure one to do this.  Did I miss the options?

**Tags:** video, ffmpeg, transcoding

> **Comments:**
> **username_1**: Please include the complete console output from your command.  
> **username_2**: Use `libfdk_aac`.  It has better quality per bitrate than ffmpeg's built-in AAC encoder.  Also, don't forget `-movflags +faststart` to put the MOOV atom at the front of the file (essential for streaming).  

---

## 1 answers

### Answer by username_3 on 2015-06-25. Score: 3 | Accepted answer

If you just want to embed a cover you might consider keeping the result as mp3, for example:
ffmpeg -i original.mp3 -i cover.png -map 0:0 -map 1:0 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" -id3v2_version 3 -write_id3v1 1 result.mp3

If you are creating mp4's, e.g. for YouTube, then I suggest to split the process to two steps - first create the video movie with no audio track, duration somewhat longer than that of the audio. Then mux the video and audio together with the -shortest option which will truncate the video to the exact duration of audio. In terms of time these two steps will take a tidbit longer than a single pass but your whole workflow will be much simpler and more manageable.

> **Comments:**
> **username_4**: Wow that really worked. Isn't that shorter with ffmpeg?  

---

