Answers.Body: <p>Alternatively you can have <code>ffmpeg</code> generate the black video with the <a href="https://ffmpeg.org/ffmpeg-filters.html#color" rel="noreferrer">color source filter</a> instead of making an image:</p>
  
  <pre><code>ffmpeg -f lavfi -i color=c=black:s=1280x720:r=5 -i audio.mp3 -crf 0 -c:a copy -shortest output.mp4
  </code></pre>
  
  <ul>
  <li><p>Since it is just black video this is one case with lossless mode (<code>-crf 0</code>) will have a smaller file size than the default lossy mode.</p></li>
  <li><p>The resulting file may not play in your player or device, but it will on YouTube.</p></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-18T20:19:31.367Z
Answers.LastActivityDate: 2020-02-18T20:19:31.367Z
Answers.UserDisplayName: llogan
Answers.Body: <p>To achieve the same result, on macOS, I'm using:</p>
  <p><code>ffmpeg -hwaccel videotoolbox -f lavfi -i color=c=black:s=1280x720:r=25/1 -i input_audio.mp3 -c:v h264_videotoolbox -q:v 50 -c:a aac -shortest output.mp4</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-07T00:11:44.383Z
Answers.LastActivityDate: 2023-03-07T00:11:44.383Z
Answers.UserDisplayName: Gabriele
Answers.Body: <p>Youtube requires a video <em>stream</em> but your image is a single frame. Loop it to create a stream and terminate output when audio ends by adding -shortest.</p>
  
  <pre><code>ffmpeg -loop 1 -i black.png -i 'input.mp3' -c:v libx264 -tune stillimage -shortest 'output.mp4'
  </code></pre>
  
  <p>I don't remember if YT accepts MP3 in MP4. If it does, you can keep <code>-c:a copy</code>. <code>-pix_fmt yuv420p</code> is usually required, but YT will re-encode anyway to that pixel format.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-15T16:18:18.823Z
Answers.Text: With `-pix_fmt yuv420p` per the answer below, the resulting video plays on macOS too.
Answers.UserDisplayName: Ahmed Fasih
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-15T05:30:57.750Z
Answers.LastActivityDate: 2020-02-15T05:30:57.750Z
Answers.UserDisplayName: Gyan
Body: <p>I have MP3 audio that I would like to turn into video, by joining the audio with a solid black background. I then want to upload the video to Youtube.</p>
  
  <p>Using ffmpeg, I have tried this command, and a few adjacent variants:</p>
  
  <p><code>ffmpeg -i 'black.png' -i 'input.mp3' -c:v libx264 -tune stillimage -c:a copy 'output.mp4'</code></p>
  
  <p><em>(where <code>black.png</code> is a PNG file that is 640×480 pixels).</em></p>
  
  <p>However, when uploading the video <code>output.mp4</code> to Youtube via Creator's Studio, I get the error: </p>
  
  <blockquote>
    <p>Processing abandoned. The video could not be processed. </p>
  </blockquote>
  
  <p>What could be the reason?</p>
  
Tags: <ffmpeg><youtube>
Title: ffmpeg: Create a black background video from audio, for Youtube upload
UserDisplayName: P A N
ThreadText: # ffmpeg: Create a black background video from audio, for Youtube upload
  
  (Asked by: username_0 on 2020-02-14)
  
  I have MP3 audio that I would like to turn into video, by joining the audio with a solid black background. I then want to upload the video to Youtube.
  
  Using ffmpeg, I have tried this command, and a few adjacent variants:
  
  `ffmpeg -i 'black.png' -i 'input.mp3' -c:v libx264 -tune stillimage -c:a copy 'output.mp4'`
  
  *(where `black.png` is a PNG file that is 640×480 pixels).*
  
  However, when uploading the video `output.mp4` to Youtube via Creator's Studio, I get the error:
  
  > Processing abandoned. The video could not be processed.
  
  What could be the reason?
  
  **Tags:** ffmpeg, youtube
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2020-02-15. Score: 13 | Accepted answer
  
  Youtube requires a video *stream* but your image is a single frame. Loop it to create a stream and terminate output when audio ends by adding -shortest.
  
  ```
  ffmpeg -loop 1 -i black.png -i 'input.mp3' -c:v libx264 -tune stillimage -shortest 'output.mp4'
  
  ```
  
  I don't remember if YT accepts MP3 in MP4. If it does, you can keep `-c:a copy`. `-pix_fmt yuv420p` is usually required, but YT will re-encode anyway to that pixel format.
  
  > **Comments:**
  > **username_4**: With `-pix_fmt yuv420p` per the answer below, the resulting video plays on macOS too.  
  
  ---
  
  ### Answer by username_1 on 2020-02-18. Score: 25
  
  Alternatively you can have `ffmpeg` generate the black video with the [color source filter](https://ffmpeg.org/ffmpeg-filters.html#color) instead of making an image:
  
  ```
  ffmpeg -f lavfi -i color=c=black:s=1280x720:r=5 -i audio.mp3 -crf 0 -c:a copy -shortest output.mp4
  
  ```
  
  * Since it is just black video this is one case with lossless mode (`-crf 0`) will have a smaller file size than the default lossy mode.
  * The resulting file may not play in your player or device, but it will on YouTube.
  
  
  ---
  
  ### Answer by username_2 on 2023-03-07. Score: 0
  
  To achieve the same result, on macOS, I'm using:
  
  `ffmpeg -hwaccel videotoolbox -f lavfi -i color=c=black:s=1280x720:r=25/1 -i input_audio.mp3 -c:v h264_videotoolbox -q:v 50 -c:a aac -shortest output.mp4`
  
  
  ---
  
  