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

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,010
163
Norway
I'm sure there's an easy answer to this, and I believe I've done it in earlier versions of QuickTime Player but.....
for some reason I can't remove audio from an MP4 video I've opened in QuickTime Player (version 10.4 on MacOS 10.13.6 High Sierra).
According to this step-step-step guide it's just a matter of going to Edit-Remove Audio, but there's no such option to be found in my Edit menu!
And "Show movie properties" (in older QuickTime Player versions) isn't available here.
The closest I can come to anything audio related is by first selecting Edit-Trim, then to View-Show Audio Track.
 

usagora

macrumors 601
Nov 17, 2017
4,869
4,451
Apparently you're not alone:

I'm on Mavericks and QuickTime 10.5 which does have the Edit > Remove Audio option.

You could try using iMovie to do this. Import the mp4 into iMovie, drag it into your movie timeline, in the top menu go to Modify > Detach Audio, then select and delete the audio track in the timeline. I'm sure you probably have an earlier version of iMovie (mine is 10.3.4), but I'm pretty sure that's been a standard iMovie feature for a while now.

By the way, in the official Apple Support document for this feature, note that in the "Select Version" drop-down menu, it only goes back to macOS 10.15, which would indicate to me that the versions of QuickTime 10 on macOS 10.14 and earlier do not have this feature.

 
Last edited:

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,010
163
Norway
Ah! So it wasn't just me or my imagination ;)
Thanks for clearing that up.

Your iMovie suggestion worked perfectly -very easy!
But how do I save the file in the same MP4 format after doing that? I was looking for an "Export" option but couldn't find one. All I can see is "Share" with various options where "File" seemed most appropriate, but apparently only saves it as an iMovie project.

All I want to do is open the MP4 file, remove the audio, then save it again (preferrably without any loss or bloating the file-size). Are there any other apps which allow me to do this kind of thing now that my QuickTime player appears to be somewhat limited?

UPDATE: iMovie does in fact save the file as MP4, and not as an iMovie project file as it first seemed to!
It takes forever to save the new file though (I had expected it to do it in a couple of seconds, but I assume it has to somehow process a completely new file). Around 14 minutes to create an audio-free MP4 of a 45 MB MP4 file on my mid-2010 Mac Pro with a 6-core 3.46GHz Xeon processor/24GB RAM. Does this sound right?
Also, the file size of the non-audio MP4 has grown to 102 MB -more than twice its original size! o_O
I did compare the two files using QuickTime Player's "Inspector" function afterwards and they both have the same format (1920x1080), but data rate had increased from 193 kbit/s to 451 kbit/s and FPS changed slightly from the original 30 to 29.97.
Finally the "Current size" had changed from 512x288 to 572x322.

It would be great to do this in a much simpler (and preferrably quicker if possible) way -maybe an OSX service or something? Right click on a video file, select the service and have a copy of the same file made but without audio.

UPDATE 2: I've just read through the Apple forum discussion you initially referred to, and it indeed suggests a (free as far as I can see) separate app for separating audio called Subler. I'm going to give it a go and also look into the Automator action suggested in the Apple forum thread.

UPDATE 3: Yup, Subler works! The documentation isn't very helpful for non-geeky types IMHO, but this appears to be the way to do it:
1) open the video file in Subler
2) select (highlight by clicking once on it) the audio track
3) press the BACKSPACE key to remove the audio track
4) save the file (or use "Save as" if you're working on the original in case you don't want to change that file but instead make a new copy)
Screen Shot 2022-08-11 at 15.47.08.png

I haven't yet looked into creating an OSX Service for doing all of this in one simple step.. if someone already has a working solution for that , please do share!
 
Last edited:

galad

macrumors 6502
Apr 22, 2022
471
363
In Subler the third toolbar item in your screenshot deletes the selected track.
 

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,010
163
Norway
With ffmpeg https://ffmpeg.org/download.html#build-mac

Code:
ffmpeg -i /path/to/video_file.mp4 -c copy -an /path/to/video_without_audio_file.mp4

Take a look here for a QuickAction/service https://forums.macrumors.com/threads/automator-applescript-help.2295459/

I'd like to try that, but I'm having trouble installing FFmpeg.
I managed to download the ZIP file which presents me with the FFmpeg binary, but couldn't find any documentation on where to put it, so (since I have Homebrew already installed) I tried installing it via that, but got some error messages. Apparently my OS (MacOS 10.13.6 High Sierra) is too old. So then I came across this documentation which says the installation no longer comes with all its dependacies, so I tried that, but also without any success (again, error messages).
I searched the web for info on how to install it manually but apparently everybody does it differently, among them a posting which said just to create a "bin" folder within your home folder and put it there, but that can't be right!
From what else I've read it does however seem to be somewhere within the /usr/ folder.
 

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
No need for homebrew, just put the ffmpeg executable in /usr/local/bin/
Here’s an adapted script
Code:
for f in "$@"
do
/usr/local/bin/ffmpeg -i "$f" -c copy -an "${f%.*}_video_only.mp4"
done
 

usagora

macrumors 601
Nov 17, 2017
4,869
4,451
Also, the file size of the non-audio MP4 has grown to 102 MB -more than twice its original size! o_O
I did compare the two files using QuickTime Player's "Inspector" function afterwards and they both have the same format (1920x1080), but data rate had increased from 193 kbit/s to 451 kbit/s and FPS changed slightly from the original 30 to 29.97.

You can adjust the quality settings / data rate upon exporting from iMovie. Simply select "Custom" under Quality. I'd suggest using Handbrake to re-encode the exported file if you have any issues with it. It often reduces the file size a TON without any noticeable loss in quality.

Screen Shot 2022-08-12 at 10.24.17 AM.png
 

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
You can adjust the quality settings / data rate upon exporting from iMovie. Simply select "Custom" under Quality. I'd suggest using Handbrake to re-encode the exported file if you have any issues with it. It often reduces the file size a TON without any noticeable loss in quality.
Re-encoding with iMovie, then with Handbrake is a complete waste of time.
You can remove all audio tracks from Handbrake.
But there is no need for re-encoding, as Avidemux and other apps can eliminate the audio track without re-encoding the video track.
 

usagora

macrumors 601
Nov 17, 2017
4,869
4,451
Re-encoding with iMovie, then with Handbrake is a complete waste of time.
You can remove all audio tracks from Handbrake.
But there is no need for re-encoding, as Avidemux and other apps can eliminate the audio track without re-encoding the video track.

It it were a "complete waste of time" then it wouldn't accomplish the end goal, yet it does, so a bit over an overstatement there. However, you are correct - I forgot that Handbrake could of course remove the audio track. It's just I rarely do that, so I wasn't thinking about that feature. I guess the OP can decide which route he wants to take, though (iMovie, Handbrake, Avidemux, etc.).
 

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,010
163
Norway
No need for homebrew, just put the ffmpeg executable in /usr/local/bin/
Here’s an adapted script
Code:
for f in "$@"
do
/usr/local/bin/ffmpeg -i "$f" -c copy -an "${f%.*}_video_only.mp4"
done

Awesome!
I put the ffmpeg binary executable in the above folder and created a new Service within the Automator app, with a few minor differences from your forum screenshot.
Screen Shot 2022-08-13 at 21.47.52.png

Screen Shot 2022-08-13 at 21.49.20.png

Here's the script I used (for those who want to copy/paste to make their own Service):
Code:
for f in "$@"
do
/usr/local/bin/ffmpeg -i "$f" -c copy -an "${f%.*} (no audio).mp4"
done

Once saved it can be seen in the ~/Library/Services/ folder:
Screen Shot 2022-08-13 at 14.37.48.png


This Service is perfect for the job! For others reading: just right-click on the video file in question, scroll down to "Services" and select this OSX-Service which will create a copy of the video file without audio and have a "(no audio)" at the end of the filename to distinguish it from the unmodified original.
PS: just remember to log out of the user after saving the Service and log in again ot make it appear in the right-click contextual menu.

Idiot-proofing it I tried to run it on a video already having had the audio removed but got a looooong error message. Would it involve a lot of complicated additional code to perhaps create a new copy in such cases with a "2" added to the end of the filename (and "3" added if run again etc.)?
Or even better..... just an alert window popping up saying something like "Audio already removed from video" with an "OK" button to dismiss it.
Similarly, an alert window could pop up if trying to run it on a video already converted: "No audio found! Audio removal not necessary" along with an "OK" button to dismiss it.
 
Last edited:

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,010
163
Norway
I guess the OP can decide which route he wants to take, though (iMovie, Handbrake, Avidemux, etc.).

It's nice to have different options and I appreciate all the suggestions given here, but for the occasional need I prefer something super-easy, and prefer the OSX Service method.
But in case it's been a while and I even forget about Services it's nice to go directly to an app as well. Thanks to you and others for the different suggestions!
 

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
Or even better..... just an alert window popping up saying something like "Audio already removed from video" with an "OK" button to dismiss it.
Similarly, an alert window could pop up if trying to run it on a video already converted: "No audio found! Audio removal not necessary" along with an "OK" button to dismiss it.
Can be done with AppleScript, this is a first draft:
Code:
on run {input, parameters}
    set theVideo to quoted form of (POSIX path of input)
    try
        do shell script "/usr/local/bin/ffmpeg -i " & theVideo & "  2>&1 | grep -i audio:"
    on error
        display dialog "No audio track found"
        return
    end try
    do shell script "/usr/local/bin/ffmpeg -i " & theVideo & " -c copy -an " & theVideo & "_NoAudio.mp4"
end run
 

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
This might be it
Code:
on run {input, parameters}
    repeat with i from 1 to the count of input
        set theVideoFile to (item i of input)
        set theVideo to quoted form of (POSIX path of (item i of input))
        try
            set AudioTrack to (do shell script "/usr/local/bin/ffmpeg -i " & theVideo & "  2>&1 | grep -i Audio:" as string)    
            try
                if AudioTrack contains "Audio" then
                    tell application "Finder"
                        set extension hidden of theVideoFile to true
                        set theName to displayed name of theVideoFile
                        set theOutputFolder to POSIX path of ((container of theVideoFile) as text)
                        set theNoAudioFile to quoted form of ((theOutputFolder & theName & " (no audio).mp4") as text)
                        set extension hidden of theVideoFile to false
                    end tell
                    do shell script "/usr/local/bin/ffmpeg -i " & theVideo & " -c copy -an " & theNoAudioFile
                end if
                --on error errorMessage
                --display dialog errorMessage
            end try
        on error
            display dialog "No audio track found on file " & theVideo
        end try
    end repeat
end run
 

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,010
163
Norway
Cool!
while working on an Automator Service, is there a way I can test things out instead of having to save it as a Service, log out and log into the OSX user before being able to try it out again?
 

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
Cool!
while working on an Automator Service, is there a way I can test things out instead of having to save it as a Service, log out and log into the OSX user before being able to try it out again?
You don’t have to do that. Once installed, a service can be edited directly. Open Automator, open the service from ~/Library/Services, modify and save the changes, test the new version.
 

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,010
163
Norway
Ah! :) So apparently logging out of the OSX user is only needed the first time.
I tried your new Applescript code and it works very well. A few minor comments/suggestions:

1) If you try to run the script once again, nothing seems to happen. This might confuse some users (but certainly much better than the previous error message.
How can I add a dialog in this case with a message something like "Nothing to do! Audio already removed" ?

2) When trying to run the script on the file without audio it displays the file-name along with the full path (which can become quite long). How can I display just the filename and not the path?
I'm guessing that the string "theVideo" is defined in this line, and something needs to be changed here, right?:
set theVideo to quoted form of (POSIX path of (item i of input))
 

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
Ah! :) So apparently logging out of the OSX user is only needed the first time.
I tried your new Applescript code and it works very well. A few minor comments/suggestions:

1) If you try to run the script once again, nothing seems to happen. This might confuse some users (but certainly much better than the previous error message.
How can I add a dialog in this case with a message something like "Nothing to do! Audio already removed" ?

2) When trying to run the script on the file without audio it displays the file-name along with the full path (which can become quite long). How can I display just the filename and not the path?
I'm guessing that the string "theVideo" is defined in this line, and something needs to be changed here, right?:
set theVideo to quoted form of (POSIX path of (item i of input))
Try this one
Code:
on run {input, parameters}
    repeat with i from 1 to the count of input
        set theVideoFile to (item i of input)
        set theVideo to quoted form of (POSIX path of (item i of input))
        try
            set AudioTrack to (do shell script "/usr/local/bin/ffmpeg -i " & theVideo & "  2>&1 | grep -i Audio:" as string)
            try
                if AudioTrack contains "Audio" then
                    tell application "Finder"
                        set extension hidden of theVideoFile to true
                        set theName to displayed name of theVideoFile
                        set theOutputFolder to POSIX path of ((container of theVideoFile) as text)
                        set theNoAudioFile to quoted form of ((theOutputFolder & theName & " (no audio).mp4") as text)
                        set extension hidden of theVideoFile to false
                    end tell
                    tell application "Finder"
                        if exists (POSIX path of (theOutputFolder & theName & " (no audio).mp4")) as POSIX file then
                            display dialog "The file was already processed"
                        else
                            do shell script "/usr/local/bin/ffmpeg -i " & theVideo & " -c copy -an " & theNoAudioFile
                        end if
                    end tell
                end if
                --on error errorMessage
                --display dialog errorMessage
            end try
        on error
            tell application "Finder"
                set theFile to displayed name of theVideoFile
            end tell
            display dialog "No audio track found on file: " & theFile
        end try
    end repeat
end run
It needs some cleaning, but I think it works as you want.
 

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,010
163
Norway
It works great and should be "idiot proof" now ;)
Thanks for all your help in doing this 👍
Now that I'm done I'm going to look into making a similar Service for creating an audio file from a video file that contains audio+video. As far as I can see this is doable with ffmpeg.

Other than making some minor changes to the dialogs I've kept the script unchanged from yours.
Screen Shot 2022-08-15 at 16.41.43.png

Here's the Applescript (for those who like to copy/paste in order to make their own Service):
AppleScript:
on run {input, parameters}
    repeat with i from 1 to the count of input
        set theVideoFile to (item i of input)
        set theVideo to quoted form of (POSIX path of (item i of input))
        try
            set AudioTrack to (do shell script "/usr/local/bin/ffmpeg -i " & theVideo & "  2>&1 | grep -i Audio:" as string)
            try
                if AudioTrack contains "Audio" then
                    tell application "Finder"
                        set extension hidden of theVideoFile to true
                        set theName to displayed name of theVideoFile
                        set theOutputFolder to POSIX path of ((container of theVideoFile) as text)
                        set theNoAudioFile to quoted form of ((theOutputFolder & theName & " (no audio).mp4") as text)
                        set extension hidden of theVideoFile to false
                    end tell
                    tell application "Finder"
                        if exists (POSIX path of (theOutputFolder & theName & " (no audio).mp4")) as POSIX file then
                            display dialog "Nothing to do!" & return & "A non-audio copy is already available." with icon caution buttons {"OK"} default button "OK"
                        else
                            do shell script "/usr/local/bin/ffmpeg -i " & theVideo & " -c copy -an " & theNoAudioFile
                        end if
                    end tell
                end if
                --on error errorMessage
                --display dialog errorMessage
            end try
        on error
            tell application "Finder"
                set theFile to displayed name of theVideoFile
            end tell
#            display dialog "No audio found in: " & theFile


display dialog "Nothing to do!" & return & "File doesn't contain any audio." with icon caution buttons {"OK"} default button "OK"
        end try
    end repeat
end run
 

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
It’s worth mentioning, for others that might be interested, that the service works for multiple files selected at the same time.
To make clear what file has been converted already or doesn’t have an audio track, the display messages can be modified to include the file name.

Code:
display dialog "Nothing to do!" & return & "A non-audio copy is already available:" & return & theName with icon caution buttons {"OK"} default button "OK"

Code:
display dialog "Nothing to do!" & return & "File " & theFile & " doesn't contain any audio." with icon caution buttons {"OK"} default button "OK"
 

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,010
163
Norway
Good to know. I've only tried it with a single file at a time.
What's the correct syntax for adding quote characters around the filename? I haven't had any success with the abvious attempts. So that the result will be something like:

File "This is a test.MP4" doesn't contain any audio.
(or with the ' character if the above isn't possible).
 

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
You can use quoted form of
Code:
    display dialog "Nothing to do!" & return & "File " & quoted form of theFile & " doesn't contain any audio." with icon caution buttons {"OK"} default button "OK"

or other characters
Code:
display dialog "Nothing to do!" & return & "File >>  " & theFile & "  << doesn't contain any audio." with icon caution buttons {"OK"} default button "OK"
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.