Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macstatic

macrumors 68010
Original poster
Oct 21, 2005
2,001
162
Norway
For practical/organizational purposes I'm wondering if it's possible to convert audio files (MP3) to MP4 video files? In other words, the audio will play the audio, but with a black or empty screen, or even just a still-image.
I created an Automator Service which sort of works:

Screenshot 2023-06-18 at 22.41.24.png



The problem is that it results in a .M4V file (and not .MP4) which for some reason isn't possible to import into iTunes.
Is there a way I can create .MP4 video files instead (preferrably using Automator)?
 
Last edited:

macstatic

macrumors 68010
Original poster
Oct 21, 2005
2,001
162
Norway
Yes -apparently M4V and MP4 are "almost" the same, but there is apparently still some noticeable differences:

First, I noticed that my M4V files had actually been imported into iTunes. But I found them in the "Music" section instead of the usual "Films". So that's good -iTunes doesn't reject them.
Interestingly, renaming the extension to .MP4 (before importing to iTunes), then importing to iTunes still results in it being placed in "Music". So apparently iTunes is looking at the file content and not just the extension.

Secondly, while in iTunes I right-clicked on one of those files and selected "Song info" to reveal more information about the file, and comparing it with the file info of a "normal" MP4 video file (i.e. an actual movie). I noticed some differences (first a normal video MP4, then an MP3 converted to M4V:

real video mp4.png


audio converted to mp4.png



Finally, despite these differences I assumed they were actually recognized as being video files, so I clicked the "Options" tab of the converted audio file and saw this:
itunes imported mp4 audio.png


Compared to a newly imported "real" MP4 video file which shows this:
itunes mp4 video.png

So in conclusion the "Audio to video" converting I did with the Automator Service doesn't actually create a proper video file. What do I need to do so that the audio can be fully recognized as an MP4 video file?
I don't have much experience in video editing, but I assume it would work if I created a new video-file using a video editing app (iMovie, Final cut etc.), add the audio to become the audio track and a still picture or something for the visual part (if needed). But this sounds time consuming and cumbersome.
A MacOS Service for this would be ideal to make it quick and simple to use.

My aim is to create an iTunes videos-playlist containing both actual video MP4 files and converted audio ("fake videos, only containing audio").
 
Last edited:

laptech

macrumors 68040
Apr 26, 2013
3,582
3,986
Earth
You will not be able to get your audio file to work like a video file because the audio file will not contain any video codec info thus only the audio codec will be seen and thus any music/video application will see it as a audio file. To get it to work like a video file you would need to use a video editor/video creator to create a blank video with the audio file edited into it.
 

macstatic

macrumors 68010
Original poster
Oct 21, 2005
2,001
162
Norway
Hmmm.... yes, that makes sense.
So basically I need to create a file with video codec added along with the audio imported as audio tracks. Does the video need some actual visual content as well? Perhaps a still image along with a low resolution to make the file as small as possible.
Is there a smart way to automate this?
 

laptech

macrumors 68040
Apr 26, 2013
3,582
3,986
Earth
If you do a web search on 'audio to video' convertor there are lots of online convertors that will convert audio to video. I just did a search and selected the top one which was Onlineconvertor. Selected an audio file, selected to use a blank image and it created a MP4 video file (tries to get you to install a lot of stuff though through ad's..very annoying but that's what you have to expect when using free online stuff). There is also an app for the mac called 'Premute' which does the job. It is free for 7 days but then $9.99 a month. That one might but more suited for you if you have a lot of files to convert and do not want the hassle of having to deal with online convertors trying to fool you into installing stuff via ad's.
 

R S K

macrumors regular
Oct 18, 2022
193
71
Hannover, Germany
M4V and MP4 are absolutely identical, yes. They are merely different container formats. It could be .AVI and still be MP4. M4V and M4A are Apple's own suffixes meant to do what it is doing for you, too, and that is to open the appropriate Apple app for playback (as well as support DRM). Both are H.264 (or even HEVC) with MPEG or any other type of audio. The only reason they are showing up as different file types is that clearly the first only has a single image (easily seen by its size alone… a 10x difference?), and is therefore being interpreted as an audio file with e.g. just album art.

So what? Would you prefer TEN FOLD or best case probably still 3-4x the amount of data just so you can get the correct metadata tag for an empty video? 🤨 It's not like you can't just add audio to a video playlist!

If you want the superfluous data, then yes, you could export them from iMovie or FCP with just a black solid. Whether there's any way of doing this with Automator with some other app that will do that I don't know. I only know that FCP cannot be controlled by Automator, so it's pretty much guaranteed iMovie can't either.

Just go with one of the above converters or get Compressor with which you can also batch-convert.
 

macstatic

macrumors 68010
Original poster
Oct 21, 2005
2,001
162
Norway
I just did a search and selected the top one which was Onlineconvertor.
Thanks. I tried it but didn't get any better results than with my Automator Service (iTunes recognized the file only as audio). I already have the Permute app (an older version though) but there's no option for converting audio to a video format. Maybe more recent versions have this capability.
I did however find a solution! FFMPEG to the rescue, and in this Stackexchange article there were some suggestions for something similar. A quick test in the MacOS Terminal did the trick using the following:

ffmpeg -f lavfi -i color=c=blue:s=1280x720 -i AUDIO_FILE.mp3 -vf "drawtext=fontfile=/path/to/font.ttf:text='Your Text':fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2" -shortest -fflags +shortest VIDEO_FILE.mp4

(Where AUDIO_FILE.mp3 is the audio file I want to convert, and VIDEO_FILE.mp4 is the resulting video file)

Obviously there are some other things going on there with a text title and so on, and I need to spend some time with the manual to tweak it fully working, but with the above command I ended up with an MP4 file which worked as a video file in iTunes! So FFPEG appears to be the solution.
I suppose once I get the parameteres correct I could create an Automator Service out of it as well :)



M4V and MP4 are absolutely identical, yes. They are merely different container formats. It could be .AVI and still be MP4. M4V and M4A are Apple's own suffixes meant to do what it is doing for you, too, and that is to open the appropriate Apple app for playback (as well as support DRM). Both are H.264 (or even HEVC) with MPEG or any other type of audio. The only reason they are showing up as different file types is that clearly the first only has a single image (easily seen by its size alone… a 10x difference?), and is therefore being interpreted as an audio file with e.g. just album art.

Are you referring to (the two topmost) screenshots in post #3?
They aren't the same file at all:
the first file (76 MB) is an actual MP4 video file to begin with which needs no converting, the second one (7.4 MB) is an MP3 audio file which I converted to video using the mentioned Automator Service (which obviously didn't work).

From various sources, such as this one, I've understood there are some minor differences like the ability to copy-protect an M4V file, but mostly they're the same.
Regardless, the problem I've been facing here appears not to have anything to do with that.

So what? Would you prefer TEN FOLD or best case probably still 3-4x the amount of data just so you can get the correct metadata tag for an empty video? 🤨 It's not like you can't just add audio to a video playlist!

Yes! For this specific purpose I choose to do that, but not generally.
This is a course with many different PDFs, videos and audio files which are to be put on an iPad. Two formats (video and PDF) at least makes it a lot easier to follow than 3 file types, because each format demands its own app.


If you want the superfluous data, then yes, you could export them from iMovie or FCP with just a black solid. Whether there's any way of doing this with Automator with some other app that will do that I don't know. I only know that FCP cannot be controlled by Automator, so it's pretty much guaranteed iMovie can't either.

Just go with one of the above converters or get Compressor with which you can also batch-convert.

I don't have any experience with Final Cut Pro nor Compressor, but might further down the line as I need to look into video editing at some stage. For now however I just need a quick and simple solution.

Having discovered that FFMPEG can do the job I'll look further into its options. With the right commands I could probably create a video file out of the MP3 with a still image.
Would that make a video file much larger than say just having a blank/black screen?
 
Last edited:

arw

macrumors 65816
Aug 31, 2010
1,091
855
Just in case you are not aware I'd like to emphasize that every transcode from 'mp3' to lossy 'aac' decreases the quality of your audio file.

However, back to your request: What hasn't been mentioned is the "Podcast" feature which sounds exactly like what you are looking for.
You can embed the file's artwork as video track so the size increase is absolutely negligible (video only consists of one single frame for the whole file).
Then rename m4a to m4v and you have it listed in iTunes under 'Home Videos'.
It simply displays the artwork in fullscreen when being played.
I just tested it with the software I have at hand, Fission:
Open AAC/m4a audio file > Save as Chapterized AAC manually rename m4a to m4v Done, you have a movie.
I do not know of a batch process but wanted to point out the technical possibility.
 

Attachments

  • audio+jpeg.video.png
    audio+jpeg.video.png
    52.5 KB · Views: 44
  • iTunes.m4v.png
    iTunes.m4v.png
    198.6 KB · Views: 46
Last edited:

macstatic

macrumors 68010
Original poster
Oct 21, 2005
2,001
162
Norway
Just in case you are not aware I'd like to emphasize that every transcode from 'mp3' to lossy 'aac' decreases the quality of your audio file.

I wasn't aware of that. With this in mind I compared the listening quality of an original MP3 audio file with that from an MP4 file created by converting the same MP3 using the FFMPEG command that I quoted in post #8:

ffmpeg -f lavfi -i color=c=blue:s=1280x720 -i AUDIO_FILE.mp3 -vf "drawtext=fontfile=/path/to/font.ttf:text='Your Text':fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2" -shortest -fflags +shortest VIDEO_FILE.mp4

To my ears there were no noticeable differences. This was speech, so it may have been different with music though.


However, back to your request: What hasn't been mentioned is the "Podcast" feature which sounds exactly like what you are looking for.

Interesting.
I don't know if I quite understood the process, but I tried importing an MP3 file to iTunes, converted it to AAC (File-Convert-Create AAC version), add the image, then changed the media kind to "Podcast".


You can embed the file's artwork as video track so the size increase is absolutely negligible (video only consists of one single frame for the whole file).
Then rename m4a to m4v and you have it listed in iTunes under 'Home Videos'.
I don't know if you can rename file extensions within iTunes, but dragging the m4a file from iTunes to a Finder window works. There I've manually renamed it to m4v and dragged it back into iTunes. However, I still don't get the ability to change the media type to video.

Back to the FFMPEG solution which looked promising.... I've been scratching my head trying to understand the various parameters and it's syntax when I realized the solution was there, on the same page I referred to as last time, all along! The following Terminal command below appears to work, creating a new MP4 video file with the MP3 audio and an image file which is seen as long as the file plays.
As it's technically an MP4 video file it should transfer and end up in the same app (TV?) as all the other MP4 videos I'll be transferring over to an iPad via iTunes on the Mac.

ffmpeg -loop 1 -i IMAGE_FILE.png -i AUDIO_FILE.mp3 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=white,setsar=1,format=yuv420p" -shortest -fflags +shortest RESULTING_VIDEO_FILE.mp4


I need to test it some more, but if this works I'm going to try to create an Automator Service out of it, which will make it a lot quicker and easier to convert multiple MP3 files.
 

arw

macrumors 65816
Aug 31, 2010
1,091
855
To my ears there were no noticeable differences. This was speech, so it may have been different with music though.
All good then. Just wanted to point out to keep the conversions to a minimum.

I don't know if I quite understood the process, but I tried importing an MP3 file to iTunes, converted it to AAC (File-Convert-Create AAC version), add the image, then changed the media kind to "Podcast".
That does not work as iTunes simply changes the tag 'ITUNESMEDIATYPE' but doesn't actually alter the file or embed the artwork as video (as you noticed).

Opening an mp3 with Garageband and saving it as (podcast) m4a should work. Then rename m4a to m4v.
Creating an automatic workflow is a different story.

I'm pretty certain the cli m4b-tool should be able to automate everything you want.
- convert mp3 to chapterized aac and embed cover.jpg as 1-frame video track
- you'd just have to automate the rename from 'm4b' to 'm4v'

Back to the FFMPEG solution which looked promising...
Consider -tune "stillimage" and
take a look at the -framerate parameter to make sure you create as few video frames as possible (1 fps or even less like -framerate 1/10 for one frame every 10 seconds). This keeps the size of the video part to a minimum and speeds up the conversion.
https://video.stackexchange.com/questions/23061/adobe-premiere-video-size-with-static-image
You also might want some control over the audio quality.
 
Last edited:

macstatic

macrumors 68010
Original poster
Oct 21, 2005
2,001
162
Norway
Consider -tune "stillimage" and
take a look at the -framerate parameter to make sure you create as few video frames as possible (1 fps or even less like -framerate 1/10 for one frame every 10 seconds). This keeps the size of the video part to a minimum and speeds up the conversion.
https://video.stackexchange.com/questions/23061/adobe-premiere-video-size-with-static-image
You also might want some control over the audio quality.

I read this after having manually converted about 10 MP3 using the MacOS Terminal with FFMPEG (thankfully there's copy/paste!), but this will come in handy the next time I need to do this :) 👍
So the converted MP4 videos also transferred fine over to the iPad, but I noticed something:

a) if I first drag the MP4 files from the Finder over to iTunes where I spend some time to organize them (by adding metadata such as Program, Genre. Comments, artwork etc.),
then (while the iPad is attached via USB to the Mac and shows up in iTunes) drag them over to the iPad (the "On my device" section in iTunes) the MP4 files show up in my iPad TV app all neatly organized according to how I organized them in iTunes:

screenshot-2023-06-18-at-23-16-09-png.2219978


b) but if I do the same first steps as above (organize the MP4 files in iTunes), but instead of dragging them over to the iPad I drag them over to a Finder window for backing up to an external hard drive.
.... some time later I want to transfer them over the iPad, so (with iTunes open and the iPad attached) I simply drag the MP4 files from the external hard drive in the Finder directly to the "On my device" section in iTunes.
The result? The MP4 files have all been transferred and appear in the TV app on the iPad, but they're all over the place! In other words: the metadata I meticulously added in iTunes doesn't appear to have been saved to the MP4 files which I dragged over to the external hard drive. I assume they're stored in iTunes itself instead?

Is there a way that I can store that metadata in the actual MP4 files?
 

ChrisA

macrumors G5
Jan 5, 2006
12,587
1,707
Redondo Beach, California
For practical/organizational purposes I'm wondering if it's possible to convert audio files (MP3) to MP4 video files? In other words, the audio will play the audio, but with a black or empty screen, or even just a still-image.

This is easy to do in a video edit app like Final Cut, and I assume iMovie would work the same way. First you create a new project then drop your audio file into an audio track then drop a still image in a video track. Stretch the still image until it has the same duration as the audio, then render it to whatever video format you like.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.