{"id":70450,"date":"2023-01-22T09:00:40","date_gmt":"2023-01-22T09:00:40","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=70450"},"modified":"2023-01-22T09:00:40","modified_gmt":"2023-01-22T09:00:40","slug":"how-linux-rescued-precious-audio-files-with-ffmpeg","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=70450","title":{"rendered":"How Linux rescued precious audio files with FFmpeg"},"content":{"rendered":"<p><span class=\"field field--name-title field--type-string field--label-hidden\">How Linux rescued precious audio files with FFmpeg<\/span><br \/>\n<span class=\"field field--name-uid field--type-entity-reference field--label-hidden\"><a title=\"View user profile.\" href=\"https:\/\/opensource.com\/users\/don-watkins\" class=\"username\">Don Watkins<\/a><\/span><br \/>\n<span class=\"field field--name-created field--type-created field--label-hidden\">Sun, 01\/22\/2023 &#8211; 03:00<\/span><\/p>\n<div class=\"clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item\">\n<p>Recently I was asked by a customer to create compact discs of priceless family recordings. My client insisted that the media be delivered as compact discs and not as digital files in an MP3 player or other similar device. One of the source recordings was on a compact disc and in AIFF format. As such my client could not play this media that contained her husband&#8217;s voice. I was able to convert it using <a href=\"https:\/\/opensource.com\/article\/21\/12\/audacity-linux-creative-app\">Audacity<\/a>, and then was able to burn it to a compact disc with Brasero, which has been my go to CD creation tool.<\/p>\n<p>The balance of the audio files were in MP3 format. I was able to create compact discs with Brasero very quickly. There was, however, one file that was so large that it exceeded the capacity of the compact disc medium. This large file contained nearly two hours of audio. The capacity of compact discs is 72 minutes.<\/p>\n<p>This presented a problem. How could I split the large file into smaller segments that would allow me to create media and fit on media that my client could use? I decided to use a DVD instead of a compact disc. Using a DVD provided me with a much larger capacity disc, but how could I convert the MP3 files to a format that would allow me to create a DVD? I tried using HandBrake, but was unable to convert MP3 to MP4 format because MP4 expected a video stream, and I had no video. Then I discovered that I could use <a href=\"https:\/\/opensource.com\/article\/17\/6\/ffmpeg-convert-media-file-formats\">FFmpeg<\/a> to convert the files.<\/p>\n<h2>Convert media files with FFmpeg<\/h2>\n<p>If you&#8217;re looking for a powerful tool to help you with your audio and video files, look no further than FFmpeg. FFmpeg is highly versatile and able to support an impressive range of popular formats like MP3, MP4, and AVI. You can also use it to convert files between different formats, which was very useful in my case.<\/p>\n<p>You can easily install FFmpeg on your Linux system in a terminal on Fedora and similar distributions:<\/p>\n<pre>\n<code class=\"language-bash\">$ sudo dnf install ffmpeg<\/code><\/pre>\n<p>On Debian and similar distributions:<\/p>\n<pre>\n<code class=\"language-bash\">$ sudo apt install ffmpeg<\/code><\/pre>\n<p>According to its man page, &#8220;FFmpeg is a very fast video and audio converter that can also grab from a live audio and video source. It can also convert between arbitrary sample rates and resize video on the fly with a high-quality polyphase filter.&#8221; FFmpeg has excellent <a href=\"https:\/\/ffmpeg.org\/ffmpeg.html\" rel=\"noopener\" target=\"_blank\">documentation<\/a> in addition to an extensive man page.<\/p>\n<p>The command-line interface of this tool might seem daunting for newcomers, but this feature is what makes it so powerful. Developers and system administrators can easily write scripts to automate complex tasks. If you make the most of this feature you can streamline your workflow like a pro.<\/p>\n<p>Using the command-line interface, I was able to convert the MP3 file to the required MP4 format using the following command:<\/p>\n<pre>\n<code class=\"language-bash\">$ ffmpeg -f lavfi -i color=c=black:s=1280x720:r=5 \n-i audio.mp3 \n-crf 0 -c:a copy -shortest output.mp4<\/code><\/pre>\n<p>The <code>-f lavfi<\/code> option sets a virtual input device as the source of the video stream. Essentially, this creates a video file (which is what a video DVD requires) instead of an audio file. The audio file I actually care about gets included thanks to the <code>-i audio.mp3<\/code> option. The video that gets created is a black screen, as defined by <code>-i: <\/code><\/p>\n<pre>\n<code class=\"language-bash\">color=c=black:s=1280x720:r=5.<\/code><\/pre>\n<\/p>\n<div class=\"embedded-resource-list callout-float-right\">\n<div class=\"field field--name-title field--type-string field--label-hidden field__item\">More Linux resources<\/div>\n<div class=\"field field--name-links field--type-link field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/linux-commands-cheat-sheet\/?intcmp=70160000000h1jYAAQ\">Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/advanced-linux-commands\/?intcmp=70160000000h1jYAAQ\">Advanced Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/rh024-red-hat-linux-technical-overview?intcmp=70160000000h1jYAAQ\">Free online course: RHEL technical overview<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-networking?intcmp=70160000000h1jYAAQ\">Linux networking cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-selinux?intcmp=70160000000h1jYAAQ\">SELinux cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/linux-common-commands-cheat-sheet?intcmp=70160000000h1jYAAQ\">Linux common commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/resources\/what-are-linux-containers?intcmp=70160000000h1jYAAQ\">What are Linux containers?<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux?intcmp=70160000000h1jYAAQ\">Our latest Linux articles<\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<p>I ran into a snag using Brasero with this new MP4 file. Brasero would not create a DVD without the addition of a couple of cstreamer codec. From some quick research, I found another open source DVD creation program called <a href=\"https:\/\/www.rastersoft.com\/programas\/devede.html\" rel=\"noopener\" target=\"_blank\">DevedeNG<\/a> that had everything I needed built-in. Upon installing the DevedeNG program, I was able to create the DVD media in 20 minutes. Your time may vary, depending on your computer system. <a href=\"https:\/\/gitlab.com\/rastersoft\/devedeng\" rel=\"noopener\" target=\"_blank\">DevedeNG<\/a> is licensed under GPLv3.<\/p>\n<h2>Solving problems with open source<\/h2>\n<p>FFmpeg is licensed under the <a href=\"http:\/\/www.gnu.org\/licenses\/old-licenses\/lgpl-2.1.html\" rel=\"noopener\" target=\"_blank\">GNU Public License<\/a>. FFmpeg is always evolving! The project is actively maintained and updated on a regular basis. This gives you the latest features, improvements, and bug fixes so you can rest easy knowing your audio and video formats are supported.<\/p>\n<p>Another way I could have resolved the space issue was by burning the MP3 audio as data files onto the DVD, leveraging the 4 GB of space available on the DVD for just the audio data. The DVD would have basically been, in that scenario, a hard drive. You&#8217;d insert it into your computer and listen to the MP3 file through music player software.<\/p>\n<p>The way I ended up burning the audio DVD created a media DVD, which is recognized by either a computer or a DVD player. Because there&#8217;s an &#8220;empty&#8221; video stream (it&#8217;s actually not empty, it has black pixels in it), DVD players recognize the media as a movie. This means that when you listen to the audio track, you&#8217;re actually watching a blank video with accompanying audio.<\/p>\n<p>There&#8217;s no right or wrong way to solve these puzzles. What&#8217;s important is that you know how to get to the place you need to be. The goal was to preserve audio that was of particular importance to my client, and open source made it possible.<\/p>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-field-article-subhead field--type-text-long field--label-hidden field__item\">\n<p>FFmpeg is a highly versatile tool that supports a range of popular formats like MP3, MP4, and AVI. You can also use it to convert files between different formats.<\/p>\n<\/div>\n<div class=\"field field--name-field-lead-image field--type-entity-reference field--label-hidden field__item\">\n<article class=\"media media--type-image media--view-mode-caption\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2023\/01\/programming-code-keyboard-laptop-music-headphones.png\" width=\"520\" height=\"292\" alt=\"Woman programming\" title=\"Woman programming\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>WOCinTech Chat. Modified by Opensource.com. CC BY-SA 4.0<\/p>\n<\/div>\n<\/article>\n<\/div>\n<div class=\"field field--name-field-tags field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux\" hreflang=\"en\">Linux<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/audio-and-music\" hreflang=\"en\">Audio and music<\/a><\/div>\n<\/p><\/div>\n<div class=\"hidden field field--name-field-listicle-title field--type-string field--label-hidden field__item\">What to read next<\/div>\n<div class=\"field field--name-field-default-license field--type-list-string field--label-hidden field__item\"><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><br \/>\n        <img decoding=\"async\" alt=\"Creative Commons License\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2023\/01\/cc-by-sa--32.png\" title=\"This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.\"><\/a>This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.<\/div>\n<section class=\"field field--name-field-comments field--type-comment field--label-hidden comment-wrapper\">\n<div class=\"comments__count\">\n<div class=\"login\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?destination=\/feed&amp;absolute=1\">Login<\/a> to post a comment.<\/div>\n<\/p><\/div>\n<\/section>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How Linux rescued precious audio files with FFmpeg Don Watkins Sun, 01\/22\/2023 &#8211; 03:00 Recently I was asked by a customer to create compact discs of priceless family recordings. My client insisted that the media be delivered as compact discs and not as digital files in an MP3 player or other similar device. One of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":70451,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-70450","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/70450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=70450"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/70450\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/70451"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=70450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=70450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=70450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}