<div dir="ltr">That is a really nice ffmpeg command! Good stuff!</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 20, 2016 at 9:33 AM, Yassin Philip <span dir="ltr"><<a href="mailto:philcm@gnu.org" target="_blank">philcm@gnu.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <p>Hi Listers!</p>
    <p>Here is a little tooly that I made that may be be of any use to
      you guys ;<br>
    </p>
    <p>Today, if you want to publish a song, pretty soon they're going
      to ask your for "the video". But sometimes you don't have the time
      / money to do it. Heck, it's a job. <a href="https://www.youtube.com/watch?v=O27yC-qLlMM" target="_blank">The "Lost
        Week" video</a> took me like a (big. Huge) week to put together,
      not counting shooting time. BTW it was edited in KDEnlive, but
      since <a href="https://www.youtube.com/watch?v=7EH9jSnYAGI" target="_blank">No
        Sister</a> (and <a href="https://www.youtube.com/watch?v=2zZO7-wo2_o" target="_blank">my Why, Phil
        show</a> and all) I use Blender for that kind of things now.</p>
    <p>Back on topic : You don't have time to put together a proper
      video for your shiny new because you have a life and recording the
      song already took the best of it lately.<br>
    </p>
    <p>Here is <a href="https://github.com/xaccrocheur/kituu/blob/master/scripts/px-video-maker.sh" target="_blank">a
        script</a> to quickly generate a <a href="https://www.youtube.com/watch?v=t-u18CbdjBE" target="_blank">cool-looking
        music video</a>, given the sound file, the cover artwork image
      and an optional ending bit :</p>
    <p><tt>#!/usr/bin/env bash<br>
        <br>
        FILE_PATH="$1"<br>
        FFMPEG="ffmpeg"<br>
        ARTIST="$2"<br>
        ALBUM="$3"<br>
        COVER_FILE_PATH="$4"<br>
        EFFECT="$5"<br>
        <br>
        if [ "$#" -ne 5 ]; then<br>
            echo "Usage: $0 [audio file path] 'artist name' 'album name'
        [artwork image file path] [point|line|p2p|cline]"<br>
            exit<br>
        fi<br>
        <br>
        convert -resize 1280x720 "${COVER_FILE_PATH}" -background none
        -gravity center -extent 1280x720 "${COVER_FILE_PATH}.jpg"<br>
        <br>
        $FFMPEG -y -i "${FILE_PATH}" -loop 1 -i "${COVER_FILE_PATH}.jpg"
        -filter_complex "[0:a]
showwaves=s=1280x310:mode=${<wbr>EFFECT}:r=25,colorkey=<wbr>0x000000:0.1:0.5[wave];[1:v][<wbr>wave]
overlay=y=H-h:eval=init[<wbr>canvas];[canvas]drawtext=<wbr>fontfile='Jura-Book.ttf':<wbr>fontsize=60:text='${ARTIST}':<wbr>x=30:y=(h-70-text_h*2.5):<wbr>fontcolor=white:shadowy=2:<wbr>shadowx=2:shadowcolor=black,<wbr>drawtext=fontfile='Jura-Book.<wbr>ttf':fontsize=72:text='${<wbr>ALBUM}':x=20:y=(h-70-text_h):<wbr>fontcolor=ff6600:shadowy=2:<wbr>shadowx=2:shadowcolor=black"
        -shortest -codec:v libx264 -crf 18 -preset fast -codec:a aac
        -strict -2 -b:a 192k "${FILE_PATH}-composite.mp4"<br>
        <br>
        if [[ -e "end.mp4" ]]; then<br>
            $FFMPEG -y -i "${FILE_PATH}-composite.mp4" -i "end.mp4"
        -filter_complex "[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v]
        [a]" -map "[v]" -map "[a]" "${ARTIST}-${ALBUM}.mp4"<br>
        <br>
            rm -rf "${FILE_PATH}-composite.mp4"<br>
        else<br>
            mv "${FILE_PATH}-composite.mp4" "${ARTIST}-${ALBUM}.mp4"<br>
        fi<br>
        <br>
        rm -rf "${COVER_FILE_PATH}.jpg"<br>
        <br>
        echo -e "<br>
        ##############################<wbr>##################<br>
        DONE : ${ARTIST}-${ALBUM}.mp4"<br>
        <br>
      </tt></p>
    This will<br>
    <ul>
      <li>Take the (PNG) cover, and center it inside a 1280x720 (AKA
        720p) pixels video ;<br>
      </li>
      <li>Generate a "wave" of the (WAV) sound file ;<br>
      </li>
      <li>Print "Artist" in Orange, And then "Title" in White, below,
        slightly bigger and offset to the left ;<br>
      </li>
      <li>Merge the 3 together ;<br>
      </li>
      <li>If there exists a file named "end.mp4" in the directory,
        append it to the final video ;<br>
      </li>
      <li>Clean up everything, and produce a file named
        "Artist-Title.mp4" in 720p.</li>
    </ul>
    <p>Notes: <br>
    </p>
    <ul>
      <li>This script depends on the ffmpeg and imagemagick packages</li>
      <li>The last argument is the style of the dancing waveform, take a
        short audio file to experiment with all 4 of them<br>
      </li>
      <li>The "end.mp4" file is optional, it's there if you want an
        ending credit / legal / whatever bit, or a nice fade out,
        anything. It's scaled to fit.<br>
      </li>
      <li>If there is a "Jura-Book.ttf" font file in the directory from
        which the script is invoked, it will be used, otherwise your
        default serif font will be.</li>
    </ul>
    With it, you can make <a href="https://www.youtube.com/watch?v=t-u18CbdjBE" target="_blank">that kind of
      music video</a> ; hope it's useful, cheers everybody, keep on
    rocking it!<br>
    <br>
    <br>
    yPhil<span class="HOEnZb"><font color="#888888"><br>
    <br>
    <pre class="m_-19923914003807790moz-signature" cols="72">-- 
Yassin "xaccrocheur" Philip
<a class="m_-19923914003807790moz-txt-link-freetext" href="http://manyrecords.com" target="_blank">http://manyrecords.com</a> / <a class="m_-19923914003807790moz-txt-link-freetext" href="http://yassinphilip.bitbucket.org" target="_blank">http://yassinphilip.bitbucket.<wbr>org</a></pre>
  </font></span></div>

<br>______________________________<wbr>_________________<br>
Linux-audio-user mailing list<br>
<a href="mailto:Linux-audio-user@lists.linuxaudio.org">Linux-audio-user@lists.<wbr>linuxaudio.org</a><br>
<a href="http://lists.linuxaudio.org/listinfo/linux-audio-user" rel="noreferrer" target="_blank">http://lists.linuxaudio.org/<wbr>listinfo/linux-audio-user</a><br>
<br></blockquote></div><br></div>