{"id":1726,"date":"2022-03-24T21:21:56","date_gmt":"2022-03-24T20:21:56","guid":{"rendered":"https:\/\/hannes.enjoys.it\/blog\/?p=1726"},"modified":"2023-02-20T21:16:18","modified_gmt":"2023-02-20T20:16:18","slug":"converting-a-whole-directory-tree-of-flac-files-to-opus-vorbis-and-deleting-the-originals","status":"publish","type":"post","link":"https:\/\/hannes.enjoys.it\/blog\/2022\/03\/converting-a-whole-directory-tree-of-flac-files-to-opus-vorbis-and-deleting-the-originals\/","title":{"rendered":"Converting a whole directory tree of FLAC files to opus\/vorbis and deleting the originals"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Because I just did it and might need to do it again, e.g.:<br><code>fd -t f -e flac -x bash -c 'ffmpeg -i \"$1\" -b:a 64k \"$1\".ogg &amp;&amp; echo rm \"$1\"' bash {}<\/code><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Remove the <code>echo<\/code> to make it actually delete the originals.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">via <a href=\"https:\/\/wiki.archlinux.org\/title\/Convert_FLAC_to_MP3#Parallel_with_recursion\">https:\/\/wiki.archlinux.org\/title\/Convert_FLAC_to_MP3#Parallel_with_recursion<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><s>Or to write them to another directory, keeping the original structure intact:<\/s><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code><s>cd \/dir\/to\/convert &amp;&amp; fd -t f -e flac -x bash -c 'D=$(dirname \"{}\"); B=$(basename \"{}\"); mkdir -p \"\/dir\/to\/write\/to\/$D\"; ffmpeg -i \"{}\" \"\/dir\/to\/write\/to\/$D\/${B%.*}.opus\"' bash {}<\/s><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">via <a href=\"https:\/\/quantixed.org\/2021\/11\/20\/convertible-using-ffmpeg-to-convert-audio-files\/\"><s>https:\/\/quantixed.org\/2021\/11\/20\/convertible-using-ffmpeg-to-convert-audio-files\/<\/s><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">^ Nope, that seems to miss files&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You should probably use beets or something&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/dfaust\/soundkonverter\">soundKonverter<\/a> is a nice tool too.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Because I just did it and might need to do it again, e.g.:fd -t f -e flac -x bash -c &#8216;ffmpeg -i &#8220;$1&#8221; -b:a 64k &#8220;$1&#8221;.ogg &amp;&amp; echo rm &#8220;$1&#8243;&#8216; bash {} Remove the echo to make it actually delete the originals. via https:\/\/wiki.archlinux.org\/title\/Convert_FLAC_to_MP3#Parallel_with_recursion Or to write them to another directory, keeping the original structure [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,53,12,40],"tags":[],"class_list":["post-1726","post","type-post","status-publish","format-standard","hentry","category-commandline","category-ffmpeg","category-linux","category-small-things"],"_links":{"self":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/comments?post=1726"}],"version-history":[{"count":5,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1726\/revisions"}],"predecessor-version":[{"id":1864,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1726\/revisions\/1864"}],"wp:attachment":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/media?parent=1726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/categories?post=1726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/tags?post=1726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}