VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Member
    Join Date
    Sep 2004
    Location
    Australia
    Search Comp PM
    Is there a tool that can batch convert mp3 to mp4 with the video just being black screen but with audio only?
    Quote Quote  
  2. Can be done with ffmpeg. Default audio in mp4 is aac.
    Quote Quote  
  3. Member
    Join Date
    Sep 2004
    Location
    Australia
    Search Comp PM
    Originally Posted by butterw View Post
    Can be done with ffmpeg. Default audio in mp4 is aac.
    Is there a GUI for this? I have no experience in using command line
    Quote Quote  
  4. Can be done with ffmpeg. Default audio in mp4 is aac.
    I was about to reply along those lines, but didn't since I couldn't come up with a specific command actually doing what is requested.
    What I don't know is if ffmpeg alone allows to create a black frame or a blank clip, with no need for an input file.
    Otherwise, it should be quite simple. In this thread for instance the following command was suggested :
    Code:
    ffmpeg -loop 1 -framerate 0.1 -i img.jpg -i audio.mp3 -c:v libx264 -crf 20 -c:a copy -shortest out.mp4
    In ffmpeg's syntax, “-i” means “input”, so here a pre-existing “img.jpg” file would be required (it can be created easily with GIMP or any decent picture editing software, or by taking a screenshot of any video beginning or ending with a black frame — preferably in PNG since it uses lossless compression), along with the “audio.mp3” file. In this example the framerate would have a non standard value, as per the O.P.'s specific request, but it was stated in the same reply that this should be avoided for compatibility reasons.
    This link was provided for further information :
    https://trac.ffmpeg.org/wiki/Slideshow
    Then, with a command that produces the desired result, it is easy to loop it in order to process an entire directory, using the FOR ... DO ... syntax (on Windows). For instance :
    Code:
    FOR %F in (*.mp3) DO ffmpeg -loop 1 -i "black.png" -i "%F" -c:v libx264 -crf 20 -c:a copy -shortest "%~nF.mp4"
    Here I removed the “-framerate” option so it should produce a standard framerate (default is 25FPS apparently).
    On the page linked above it is implied that MP3 is not supported by the MP4 container, but I've read on this forum that it was in fact supported, and, doing a quick test, it seems to work with no issue indeed. It is preferable whenever possible to preserve the native stream as re-encoding always degrades the quality somewhat. If there is an issue (with a standalone device which does not accept MP4 files with MP3 audio), then replace “-c:a copy” with “-c:a aac -b:a 192k” as suggested on the page linked above (which means : the audio stream will be re-encoded as AAC with an average bitrate of 192kbps).
    For this to work, ffmpeg.exe should be in the same directory as the input files, or included in Windows PATH. Otherwise the complete path should be specified in the command itself, for instance : "C:\command line tools\ffmpeg\ffmpeg.exe".
    The argument “%~nF” stands for the name of input file %F without its extension, so if an input file is called "dummy song name.mp3", the ouput will be called "dummy song name.mp4". Quotation marks are required if there's at least one space in the file name or path name. Another potential caveat are file names with accentuated or special characters, which require to set a special codepage (but this is rare with english language file names).
    The command can be executed from the command prompt (CMD) or from a batch script, which is a simple text file saved with a .bat extension. But in a .bat script the “%” percent signs must be doubled.


    Is there a GUI for this? I have no experience in using command line
    You could consider this an opportunity to get some.
    Last edited by abolibibelot; 26th Dec 2020 at 16:25.
    Quote Quote  
  5. It's not clear what the desired objective of converting mp3 to mp4 is. It's possible that converting to .m4a (mp4 audio) or .mkv (black frame + keep mp3 audio) would be preferable.

    If video output is actually needed, ffmpeg can generate a blank clip of any color using -f lavfi or an input blank image can be used as suggested.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!