<p>Basic command syntax would be</p>

<pre><code>ffmpeg -i in.mp3 -filter_complex "color[c];[c][0]scale2ref[c][art];[c][art]overlay" -shortest out.mp4
</code></pre>

CC BY-SA 3.0
2017-12-11T14:50:45.993Z
This does not work, the error I get is "image: No such file or directory". Frankly I don't understand this command at all although I think I understand what you are trying to do. But why first.png and second.png?
Mike Versteeg
CC BY-SA 3.0
2017-12-11T15:20:09.700Z
It's a template command. You have to replace image and audio with the names/paths of the image and audio you want to process. first and second.png are the names I've put for the extracted album art. I see two in the input properties you have added in your command. This command generates three outputs. The first is the video, and the next two, the extracted images.
Gyan
CC BY-SA 3.0
2017-12-11T15:28:28.370Z
I don't want to add images, I want to use the embedded image (the album art, see my Q).
Mike Versteeg
CC BY-SA 3.0
2017-12-11T16:09:53.837Z
Ah, now I see. I think your Q should be reworded, maybe "How to create a regular video from a MP3 using its cover art as the video input?" - I didn't see your new title - only reread the body.
Gyan
CC BY-SA 3.0
2017-12-11T16:13:17.413Z
I never changed the title? Anyway, I hope you understand my question now :).
Mike Versteeg
CC BY-SA 3.0
2017-12-11T17:28:33.823Z
edited command.
Gyan
CC BY-SA 3.0
2017-12-11T14:31:50.137Z
2017-12-11T17:28:16.703Z
2017-12-11T17:28:16.703Z
Gyan
<p>I know that you were trying to find a way to do this in a single step. However, for those who stumble across this question, it's much easier to chain two <code>ffmpeg</code> commands like so:</p>

<pre><code>ffmpeg -i in.mp3 -an out.png &amp;&amp; ffmpeg -loop 1 -i out.png -i in.mp3 -c:a aac -ab 256k -c:v libx264 -pix_fmt yuv420p -shortest -strict -2 out.mp4
</code></pre>

<p>Note that this reencodes the mp3, as it's not a supported codec in mp4 containers.</p>

CC BY-SA 4.0
2019-10-04T04:42:06.463Z
MP3 is supported in MP4 by the file format standard but not by many players.
Gyan
CC BY-SA 4.0
2019-10-03T17:39:25.857Z
2019-10-03T18:16:27.180Z
2019-10-03T18:16:27.180Z
marumari
<p>I know you can use FFmpeg to extract the album art of an mp3 file. I also know you can combine an image and audio file to create a video. But, to my surprise, I cannot figure out nor find a way to do this in one step. Has anyone ever figured this out or is it really impossible?</p>

<p>What might be useful is FFmpeg does demux the album art, but it does not show up as video frames. E.g.</p>

<pre><code>ffmpeg -i 1.mp3 out.mp4
</code></pre>

<p>results in</p>

<pre><code>Input #0, mp3, from '1.mp3':
  Metadata:
    artist          : Dazzled Sticks
    TST             : Dazzled Sticks - Let's Dans (Martijn Groeneveld Mashup)
    genre           : Hiphop/Rap
    title           : Dazzled Sticks - Let's Dans (Martijn Groeneveld Mashup)
    date            : 2016
  Duration: 00:02:46.84, start: 0.025056, bitrate: 154 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    Metadata:
      encoder         : Lavc56.26
    Stream #0:1: Video: png, rgb24(pc), 1800x1800 [SAR 11811:11811 DAR 1:1], 90k
 tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Other
    Stream #0:2: Video: png, rgb24(pc), 1800x1800 [SAR 11811:11811 DAR 1:1], 90k
 tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Other
</code></pre>

CC BY-SA 3.0
2017-12-11T13:23:26.530Z
What's your album art extraction command? Is it a regular stream or a binary tag packet?
Gyan
CC BY-SA 3.0
2017-12-11T14:03:04.650Z
I don't understand your question. As we are discussing mp3 files, the art would need to come from its ID3 tag. Is there any other form of embedding album art these days?
Mike Versteeg
CC BY-SA 3.0
2017-12-11T14:05:20.950Z
Sorry, been a long time since I dealt with MP3 metadata. With some formats, ffmpeg demuxes the cover images as a distinct stream and with others, as a tag blob i.e. `-map` won't apply.
Gyan
CC BY-SA 3.0
2017-12-11T14:15:36.550Z
I added some more details related to this in the original Q.
Mike Versteeg
<video><ffmpeg><audio>
FFmpeg: Convert mp3 & album art to video in one step?
Mike Versteeg
# FFmpeg: Convert mp3 & album art to video in one step?

(Asked by: username_0 on 2017-12-11)

I know you can use FFmpeg to extract the album art of an mp3 file. I also know you can combine an image and audio file to create a video. But, to my surprise, I cannot figure out nor find a way to do this in one step. Has anyone ever figured this out or is it really impossible?
What might be useful is FFmpeg does demux the album art, but it does not show up as video frames. E.g.
ffmpeg -i 1.mp3 out.mp4

results in
Input #0, mp3, from '1.mp3':
  Metadata:
    artist          : Dazzled Sticks
    TST             : Dazzled Sticks - Let's Dans (Martijn Groeneveld Mashup)
    genre           : Hiphop/Rap
    title           : Dazzled Sticks - Let's Dans (Martijn Groeneveld Mashup)
    date            : 2016
  Duration: 00:02:46.84, start: 0.025056, bitrate: 154 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    Metadata:
      encoder         : Lavc56.26
    Stream #0:1: Video: png, rgb24(pc), 1800x1800 [SAR 11811:11811 DAR 1:1], 90k
 tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Other
    Stream #0:2: Video: png, rgb24(pc), 1800x1800 [SAR 11811:11811 DAR 1:1], 90k
 tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Other

**Tags:** video, ffmpeg, audio

> **Comments:**
> **username_1**: What's your album art extraction command? Is it a regular stream or a binary tag packet?  
> **username_0**: I don't understand your question. As we are discussing mp3 files, the art would need to come from its ID3 tag. Is there any other form of embedding album art these days?  
> **username_1**: Sorry, been a long time since I dealt with MP3 metadata. With some formats, ffmpeg demuxes the cover images as a distinct stream and with others, as a tag blob i.e. `-map` won't apply.  
> **username_0**: I added some more details related to this in the original Q.  

---

## 2 answers

### Answer by username_1 on 2017-12-11. Score: 1 | Accepted answer

Basic command syntax would be
ffmpeg -i in.mp3 -filter_complex "color[c];[c][0]scale2ref[c][art];[c][art]overlay" -shortest out.mp4

> **Comments:**
> **username_0**: This does not work, the error I get is "image: No such file or directory". Frankly I don't understand this command at all although I think I understand what you are trying to do. But why first.png and second.png?  
> **username_1**: It's a template command. You have to replace image and audio with the names/paths of the image and audio you want to process. first and second.png are the names I've put for the extracted album art. I see two in the input properties you have added in your command. This command generates three outputs. The first is the video, and the next two, the extracted images.  
> **username_0**: I don't want to add images, I want to use the embedded image (the album art, see my Q).  
> **username_1**: Ah, now I see. I think your Q should be reworded, maybe "How to create a regular video from a MP3 using its cover art as the video input?" - I didn't see your new title - only reread the body.  
> **username_0**: I never changed the title? Anyway, I hope you understand my question now :).  
> **username_1**: edited command.  

---

### Answer by username_2 on 2019-10-03. Score: 2

I know that you were trying to find a way to do this in a single step. However, for those who stumble across this question, it's much easier to chain two ffmpeg commands like so:
ffmpeg -i in.mp3 -an out.png && ffmpeg -loop 1 -i out.png -i in.mp3 -c:a aac -ab 256k -c:v libx264 -pix_fmt yuv420p -shortest -strict -2 out.mp4

Note that this reencodes the mp3, as it's not a supported codec in mp4 containers.

> **Comments:**
> **username_1**: MP3 is supported in MP4 by the file format standard but not by many players.  

---

