
<feed xmlns="http://www.w3.org/2005/Atom">
    <generator>Hugo -- gohugo.io</generator>
    <title>
                youtubedl on
            
        
        The Neo-Babbage Files</title>
        <link href="https://babbagefiles.xyz/categories/youtubedl/atom.xml" rel="self" type="application/atom+xml" /><link href="https://babbagefiles.xyz/categories/youtubedl/"/>
    <updated>2025-12-29T11:00:32+00:00</updated>
    <author>
            <name>Benjamin Slade</name>
            
                <email>slade@lambda-y.net</email>
            </author>
    <id>https://babbagefiles.xyz/categories/youtubedl/</id>
        
        <entry>
            <title type="html"><![CDATA[youtube-dl bash shell function: prefer mp4, and timestamp with download time]]></title>
            <link href="https://babbagefiles.xyz/youtube-dl-mp4-downloadtime/"/>
            <id>https://babbagefiles.xyz/youtube-dl-mp4-downloadtime/</id>
            
                    <author>
                        <name>Benjamin Slade</name>
                    </author>
            <published>2019-05-27T22:17:00-05:00</published>
            <updated>2025-02-15T23:06:21-06:00</updated>
            
            
            <content type="html"><![CDATA[<p>In case it&rsquo;s useful, a quick Bash shell function which takes a single
argument (a web address that is processable by <code>youtube-dl</code>) and
returns the best quality mp4 version (in case you need to deal with a
device that doesn&rsquo;t like modern video encodings/containers), with the
<strong>download time</strong> as the file&rsquo;s modification time timestamp (useful if
you have a directory of downloaded videos and want to quickly see the
last N files you downloaded, rather than the files being sorted by
upload time).</p>
<p>Add to your <code>~/.bashrc</code> or other shell configuration file as appropriate:</p>
<div class="highlight"><pre class="chroma"><code class="language-shell" data-lang="shell">youtubemp4<span class="o">()</span> <span class="o">{</span>
    youtube-dl -f <span class="s1">&#39;bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4&#39;</span> <span class="s2">&#34;</span><span class="nv">$1</span><span class="s2">&#34;</span>
    touch <span class="s2">&#34;</span><span class="k">$(</span>youtube-dl -f <span class="s1">&#39;bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4&#39;</span> --get-filename <span class="nv">$1</span><span class="k">)</span><span class="s2">&#34;</span>
<span class="o">}</span>
</code></pre></div><p>Then call in the command-line, e.g. <code>youtubemp4 https://www.youtube.com/watch?v=Gnnb6sjgk3A</code>.</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://babbagefiles.xyz/categories/shell" term="shell" label="shell" />
                             
                                <category scheme="https://babbagefiles.xyz/categories/bash" term="bash" label="bash" />
                             
                                <category scheme="https://babbagefiles.xyz/categories/youtubedl" term="youtubedl" label="youtubedl" />
                            
                        
                    
                 
                    
                 
                    
                
            
        </entry>
    
</feed>
