Extract Original-Format Audio From A Video (2016)

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
likesItClear
New Cone
New Cone
Posts: 2
Joined: 29 May 2016 09:11

Extract Original-Format Audio From A Video (2016)

Postby likesItClear » 30 May 2016 03:22

Greetings,

I included the year in the thread Subject to distinguish it from the previous ones on the same subject since they offered creative help that 1) was different from one another and/or 2) didn't work. I'm a Newbie to this forum, but not to forums in general. I've belonged to enough forums to know that forum-membership criteria don't include the important criterion for any new thread: Due Diligence prior to creating the thread. To Wit:

1. Yes, I've spent more than two hours researching this on the Internet.
2. Yes, I looked through the VLC-wiki (https://wiki.videolan.org).
3. Yes, I've probed this forum for information (searched for "extract" that resulted in: "Search found 1429 matches: extract - 72 pages of threads")
4. Yes, I reviewed all 72 pages. Below are only pertinent threads after 2008 because anything before that might have been addressed in subsequent upgrades, and because only the more recent ones wanted the audio extracted and not converted. I don't know when VLC introduced the original-audio format extract, but all of the threads showed a clear expectation that it could be done with most attempting it from the command line.
5. Yes, I'm familiar with the elements of the subject (Video and Audio formats and containers, differences between Unix Korn-shell scripting and DOS scripting, the difference between extraction and conversion, ...)
6. Yes, I have a moderate technical background (BSEE, 15+ years in Product or Software Q/A, 8.5 years in IT).

Does that qualify as "due diligence"?

I want to EXTRACT original-format audio from a video via the Command Line. FFMpeg apparently can do it, but they don't have a mux-format code for AAC. I have the means to know what the video's audio coding format is, but I don't want to convert it to the same format - I want to get the original audio EXTRACTED. I only want to deal with videos with ONE audio track - it's not even really a "track", it's really "the Audio" component as opposed the "the Video" component. Pick any YouTube video as an example. I would like it to work for the 4-5 most popular video types and 4-5 of their most popular audio formats. And, if possible, I would like the "channels" number to be "open" in that either -1 or -2 channels will be extracted properly (this is no big deal since I can detect the number of channels from the video beforehand).

My platform is Windows 7 Pro on a five-year old HP P7-1174 desktop PC. The OS and all pertinent applications are current version, in particular, VLC is v2.2.1. I've been using JPSoft (https://jpsoft.com) scripts since the mid-70s (their commands are founded on DOS commands). I used Unix Korn-shell scripts when I was in IT and saw references to Ubuntu and Linux in the threads I reviewed. I tried to make their examples work, but my lack of VLC command-line experience made that futile. I've seen 6-7 examples of extraction and conversion commands, none of which I could get to work. The only things they have in common is "-I dummy" in the front and "vlc://quit" at the end - and the "vlc://quit" doesn't work.

Many of the threads I looked at had snippets of commands or just an un-associated comment on what to do. Ironically (and sadly) the VLC-wiki has an entry on this very subject ( https://wiki.videolan.org/Extract_audio/), but it is presented in pieces in lecture format, AND the important part "Specifying output format - Extracting audio in original format" has "vlc" for the executable (that's okay) and then just uses a DVD as a source with a AC3 as the destination, but none of the "glue" commands included. It was a Unix example (which is okay) but it wasn't intact, complete, or simple.

I don't want to be spoon-fed, but I would like - not an "Example" - known good, Windows 7+, tested, verified, working, intact, complete command-line commands from "-I dummy" to "vlc://quit" (i.e., working versions of them). A link to another "how to" website will tell me that nobody at VLC knows how to do it - or that it can't be done. That was an angry observation by the thread originator in one of the threads I reviewed. I don't think it's true.

Whatd'ya say?


====================================
Search found 1429 matches: extract
72 pages of threads.

Re: Extracting audio from an .mp4 file
I found "preserve the original", but it was preceded by "not" and it was not the same subject

Re: Can't extract Audio-Track from any Video File
The originator couldn't get any audio extracted nor any more help after 27 Dec 2014

Re: Extract original audio
The one reply was: "Yes, just don't specify a acodec and put vcodec=none while transcoding."
Which didn't work in any of the (failed) examples I'd assembled. Most did nothing.

Re: Extracting audio in original format from .ts file?
Opened 28 Feb 2014; got one off-topic update 30 May 2014 that was about a similar problem.
That was the last entry.

Extraction audio tracks from a music dvd (there is no "RE: ")
Only the original 15 Jan 2013 plea for help.

Re: Unable to extract audio (from DVD or avi)
Opened 27 Nov 2012. Got one kind "Not sure" suggestion on the 28th.

Re: Enable to extract music from a video to a WAV fil
Opened 13 Sep 2012.
On 16 Sep, was told that it was a bug in VLC 2.0.3.
On 17 Sep. someone recommended using QuickTime.

Re: Best version to perform transcoding
09 May 2012 opened thread
08 Jun 2012 resorted to repeating original request
02 Jul 2012 got a snippet of instruction (part of overall command-line command?)
02 Jul 2012 last update "Thank you."
None of which was of any use to me, but it was funny to read.

Re: Extract audio just as it is -- no transcoding
13 Mar 2012 opened thread complaining about "vlc --no-sout-video dvdsimple:///dev/scd0@1:1 :sout='#std{access=file,mux=raw,dst=./file.ac3}'"
being the only example that didn't apply. It was a very detailed opening thread.
18 Mar 2012 Originator saw the wisdom in giving up on any command-line help and used the VLC GUI.

Re: New Class to extract audio
It was about compiling, which I only know enough about to know that a don't want to know any more about it.

Re: simple dvd extract question
Didn't look at it since it was about a DVD.

Re: extract just the audio from webm files
30 Aug 2011 opened thread -and- updated it with a vague "Never mind. Figured it out"
13 Dec 2011 and 24 Dec 2014 two other Users explained how to do it using ffmpeg

Re: How extract mp3 sound from video file
16 Nov 2011 opened thread
(a few exchanges about new requirements of new VLC version with inter-mixed curt statements about what to do)
24 Nov 2011 last entry with Originator still unable to do it.

Re: how to save the audio as mp3 from a flv files?
15 Oct 2011 opened thread.
20 Oct 2011 Another User recommended using "FLV Extract", plus a link to a Blog that had an incomplete example that was one that I couldn't get to work either.

Re: extract audio
20 Apr 2011 opened thread
22 Apr 2011 A User recommended ffmpeg or Mencoder
22 Apr 2011 Originator found solution and was kind enough to put it in thread: Use ffmpeg and Audacity.

Extract Audio From Video Using VLC? (There is no "Re: ")
10 Jan 2011 opened thread. Not clear if this is about the GUI or command line.
Doesn't matter - there were no thread updates.

Re: Extract audio from video file
08 Dec 2009 opened thread. it was about using the GUI.
(a few thread updates)
20 Feb 2010 A (Developer) User offered command-line code for copy/paste.
04 Dec 2010 LAST UPDATE. Another User, not previously in the thread, reported it didn't work and included verbose information.

kmf31
Cone that earned his stripes
Cone that earned his stripes
Posts: 308
Joined: 11 Mar 2007 21:47

Re: Extract Original-Format Audio From A Video (2016)

Postby kmf31 » 30 May 2016 07:59

I am using linux command lines (I don't use/have any version of Windows) but I suppose you know how to use vlc command line options in Windows.

I believe there is no "official" way to extract only audio using vlc (at least no simple way) but you can cheat in the following way:

1) if audio track is in ac3 (or eac3 as in my case) I succeeded with:

vlc videofile.extension :sout='#transcode{vcodec=none}:std{access=file,mux=raw,dst=audio.ac3}' :no-sout-all --no-loop vlc://quit

where videofile.extension represents some arbitrary video file with at least one audio track. The absence of acodec in transcode means "no transcoding", i.e. simple copy of audio without modification. The vcodec=none does not really exist as option (I believe) and gives an error message but with the nice/wanted result that NO video is put into the file (therefore "cheating"). Concerning the mux/format: "raw" works well with ac3 (and some other audio formats such as mp3, mp2 but I believe it does NOT work with aac !!).


2) if audio track is in aac and video in h264 then the above command does not work but you can do the following:

vlc videofile.extension :sout='#transcode{vcodec=mpeg2}:std{access=file,mp4=raw,dst=audio.mp4}' :no-sout-all --no-loop vlc://quit

Here the choice for the mux/container is mp4 (it seems raw does not work for aac) but in this case the option "vcodec=none" would also keep the video in the file which you do not want. Therefore one can transcode the video on purpose to something else (e.g. mpeg2) which is NOT compatible with the container mp4 such that vlc refuses to put the video into the file, again the wanted result by "cheating" (and in this case also waste of cpu-time).

In both cases the other options imply:

:no-sout-all => choose only one/first/default audio track in case the source video has several audio tracks (can be omitted if video has only one audio track)
--no-loop => do not repeat the procedure at infinitum in case vlc is in loop mode by default (as in my case), i.e. if the loop button is pressed
vlc://quit => tells vlc to quit once the procedure is done
You can add "--intf dummy" if you want to avoid showing the control-interface of vlc. However this interface just gives you a nice progress bar and you can easily stop in the middle in case of a problem etc.

-----
Another independent not tested idea: using somehow streaming, i.e. starting one vlc instance as streaming serveur (udp or rtp ?) and another one as client which records the stream and here use the option to select a particular elementary stream (ES) such as a certain audio track. The streaming container should be TS in this case. This solution requires to figure out the exact appropriate options and I not at all sure that it might work ...

As already seen/mentioned an "additional" issue is to know which mux/container works with a certain audio codec (e.g. raw for ac3, mp3, ... and mp4 for aac).

likesItClear
New Cone
New Cone
Posts: 2
Joined: 29 May 2016 09:11

Re: Extract Original-Format Audio From A Video (2016)

Postby likesItClear » 28 Jun 2016 09:34

First, my thanks to "kmf31" for offering Linux information and examples. As expected, they did not work directly on a Window's "Elevated Command" window (Windows' sorry excuse for a proper DOS Shell). The examples did offer suggestions for other ways of trying it, most notably putting the target filename first. I appreciate the interest and effort in making the thread entry.

Yes, I'm quite familiar with formatting "DOS" commands and I recognize Unix punctuation-mark field-separators. I've been using DOS since the late 1980s. From 1997-2007 I was a contractor, and later employee, on an IT Software Development Team of a cell-phone company using Unix on IBM AIX and HP-UX operating systems. There I wrote numerous Korn-shell scripts for application and system/network monitoring. To this day I use the "tr" command with octal-values of non-printing characters in a Windows batch script to remove them from a string that would otherwise balk when sending it to stdout.

BUT!, I don't know what the DOS-equivalent of Unix field separators are, NOR do I know the proper DOS-equivalent command syntax nor even DOS-specific commands themselves - THAT'S WHY I opened this forum thread!

It's abundantly clear from the silence of Forum Administrators or VideoLAN Windows SMEs that videoLAN.org has nothing but distain and loathing for Windows users, considering us to be virtual Scum worthy of acknowledgement only to the extent of accepting donations. That affront is tempered by the obvious disregard for Unix/Linux users in their treatment documented in the numerous threads I researched and listed in my original entry. Several of them finally got smart and just gave up.

To wit -

I waited a month to see if any other thread updates appeared. I realize now that VLC is just an accidental Windows app and decided to use another video player but keep VLC until I had switched over. I attempted to remove the file-type associations from VLC directly and by using the Windows Control Panel's "Default Programs" utility. Guess what happened. After 2-3 attempts both ways, I could not disassociate the file types from VLC - VLC has built-in nastiness towards Windows. I had to remove VLC to free-up the file-associations. That was my desired - actually "necessary" - state of VLC anyhow, so the happy feeling of relief came earlier than planned.

To my fellow Windows users I offer the following:

1. When you use VLC to view a video, get down on your knees and thank videoLAN.org for their gracious tolerance of your unworthy existence and outrageous groping of VLC.
2. Even if you have a Ph.D. in Computer Sciences (or related field) don't even think about trying to get a Windows "DOS" command to work - because there is no such thing.
3. If you want a video player that is part of the GNU community, try SMPlayer (http://smplayer.sourceforge.net). It is FAR superior to VLC. It doesn't have command-line capability, but then neither does VLC.

SMPlayer is primarily a source-code source, but it also has un-official builds for Windows. The Windows builds are available in 32b and 64b ( http://www.fosshub.com/SMPlayer.html/sm ... -win32.exe , http://www.fosshub.com/SMPlayer.html/sm ... .0-x64.exe ). If you don't like the Gaudy Clown look, there are Windows-like options for the interface, but they are too stoic even for me. The combination I settled on is: GUI - SkinnableGUI ; Skin - Gonzo ; Style - Fusion. That's just where I stopped. One set of options I tried first even had an "advance one-frame" button. Also, SMPlayer seems to be a/the GUI for MPlayer, also in the GNU community. It only has a 32b (un-official) download option which might be more appealing to some ( http://www.mplayerhq.hu/design7/info.html ). I didn't try it as I'm happy with 64b SMPlayer.

When I became a Webmaster I had a choice of what kind of Website Hosting Services platform I wanted - Windows or Unix. I chose Unix. I like Windows, but next to Unix it's clumsy. So, I understand why VLC on "Unix-like" platforms is popular and probably well supported. But Windows isn't going away and since VLC isn't likely to ever be a true Windows app in practice or support, I can, and I have, gone away from VLC and this forum thread.

NeuNeuRolf
Blank Cone
Blank Cone
Posts: 14
Joined: 26 Dec 2019 09:00

Re: Extract Original-Format Audio From A Video (2016)

Postby NeuNeuRolf » 26 Dec 2019 09:08

Sorry to bother you all, but I'm new to vlc and would like on Windows 10 to extract the audio from a DVD.

I found out how to do that while converting into wav :
vlc.exe -I dummy --no-sout-video --sout-audio --no-sout-rtp-sap --no-sout-standard-sap --ttl=1 --sout-keep --sout "#transcode{acodec=s16l,channels=2}:std{access=file,mux=wav,dst=$NN.wav}" dvdsimple:///D\:#3:${NN}-3:${NN} vlc://quit
I can convert that to mp3 afterwards, so that's basically what I want.

Now I don't really need to convert because my music player can play ac3, which is the original audio format of a DVD, or so I've been told. When I try to get that directly like this :
/vlc.exe -I dummy --no-sout-video --sout-audio --no-sout-rtp-sap --no-sout-standard-sap --ttl=1 --sout-keep --sout '#std{access=file,mux=raw,dst=1.ac3}' :no-sout-all dvdsimple:///D\:#3:1-3:1 vlc://quit
Then I get a file of about the right size, but the audio is scrambled.

Any ideas, tips, hints would be highly appreciated !

NeuNeuRolf
Blank Cone
Blank Cone
Posts: 14
Joined: 26 Dec 2019 09:00

Re: Extract Original-Format Audio From A Video (2016)

Postby NeuNeuRolf » 26 Dec 2019 13:59

Ok, thanks to
https://forum.videolan.org/viewtopic.php?t=139862
https://forum.videolan.org/viewtopic.php?f=14&t=135250&p=447359&hilit=audio+track#p447359
I found the solution : --no-sout-all

NeuNeuRolf
Blank Cone
Blank Cone
Posts: 14
Joined: 26 Dec 2019 09:00

Re: Extract Original-Format Audio From A Video (2016)

Postby NeuNeuRolf » 26 Dec 2019 14:21

I want to EXTRACT original-format audio from a video via the Command Line. FFMpeg apparently can do it, but they don't have a mux-format code for AAC. I have the means to know what the video's audio coding format is, but I don't want to convert it to the same format - I want to get the original audio EXTRACTED. I only want to deal with videos with ONE audio track - it's not even really a "track", it's really "the Audio" component as opposed the "the Video" component. Pick any YouTube video as an example. I would like it to work for the 4-5 most popular video types and 4-5 of their most popular audio formats. And, if possible, I would like the "channels" number to be "open" in that either -1 or -2 channels will be extracted properly (this is no big deal since I can detect the number of channels from the video beforehand).
I can do it that way :

for NN in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do
/cygdrive/c/Program\ Files\ \(x86\)/VideoLAN/VLC/vlc.exe -I dummy --no-sout-video --sout-audio --no-sout-rtp-sap --no-sout-standard-sap --no-sout-all --ttl=1 --sout-keep --sout "#std{access=file,mux=raw,dst=$NN.ac3}" dvdsimple:///D\:#3:$NN-3:$NN vlc://quit
done

NeuNeuRolf
Blank Cone
Blank Cone
Posts: 14
Joined: 26 Dec 2019 09:00

Re: Extract Original-Format Audio From A Video (2016)

Postby NeuNeuRolf » 29 Nov 2020 19:55

Oookay ... in the meantime I wrote a script that does this ... and here we go :

Code: Select all

TitNum=1 KapVon=0 KapBis=0 SecVon=-1 SecBis=0 AudNum=0 ErgVlc='wav' BitRat=256 TrnKap=0 TstMod=0 PreFix="" WinDrv="D" UseAac=0 AddOpt="" ################################################################################ usage() { cat <<EOF Gebrauch: $0 [-t <Titel>] [-v <von>] [-b <bis>] [-V <von>] [-B <bis>] [-a <Audiospur>] [-m <Modus>] [-r <kbits/s>] [-p <prefix>] [-s] [-c] [-l <Laufwerk>] [-T] t: Titelnummer, default ist ${TitNum} v: Anfangskapitel, default ist ${KapBeg} b: Endkapitel, default ist ${KapEnd} V: Anfang in Sekunden (positioniert nicht zuverlässig) B: Ende in Sekunden (positioniert nicht zuverlässig) a: Audiospur, default ist ${AudNum} m: code der Extraktion, default ist "${ErgVlc}" pcm: [DVD] -> pcm -> wav -> mp3 (vbr) wav: [DVD] -> wav -> mp3 (vbr) ac3: [DVD] -> ac3 -> ac3/m4a (cbr) dts: [DVD] -> dts -> ac3/m44 (cbr) r : bitrate für ac3 in kbit/s, default ist ${BitRat} l : Windows-Laufwerk, default ist "${WinDrv}" p : prefix vor die generierten Dateinamen s : trenne Kapitel in einzelne Dateien c : verwende aac/m4a anstelle von mp3 T : Testmodus EOF } ################################################################################ while getopts "t:m:v:b:V:B:a:r:sThp:l:c" OptNam do case "${OptNam}" in t) TitNum=${OPTARG};; v) KapVon=${OPTARG};; b) KapBis=${OPTARG};; V) SecVon=${OPTARG};; B) SecBis=${OPTARG};; a) AudNum=${OPTARG};; m) ErgVlc=${OPTARG};; r) BitRat=${OPTARG};; p) PreFix=${OPTARG};; l) WinDrv=${OPTARG};; s) TrnKap=1;; c) UseAac=1;; T) TstMod=1;; *) usage; exit 1;; esac done ################################################################################# case "${ErgVlc}" in pcm) TraVlc='#transcode{acodec=s16l}:std{access=file,mux=raw' ;; wav) TraVlc='#transcode{acodec=s16l}:std{access=file,mux=wav' ;; ac3) TraVlc='#std{access=file,mux=raw' ;; dts) TraVlc='#std{access=file,mux=raw' ;; *) printf "\n\"%s\" is not a valid work mode\n\n" "${ErgVlc}" usage exit 1;; esac ################################################################################ TstKom="" if (( TstMod > 0 )) then TstKom="echo" fi # Sekundengrenzen müssen beide angegeben werden SecIst=0 (( SecVon > 0 && SecBis > SecVon )) && (( SecIst = 1 )) (( SecIst > 0 )) && AddOpt="${AddOpt} --start-time=${SecVon} --stop-time=${SecBis}" # Grenzen werden mit führenden Nullen versehen SecVon=$( printf "%04d" "${SecVon}" ) SecBis=$( printf "%04d" "${SecBis}" ) # Angabe nur einer Kapitelgrenze bedeutet nur dieses eine Kapitel (( KapBis > 0 && KapVon == 0 )) && (( KapVon = KapBis )) (( KapVon > 0 && KapBis == 0 )) && (( KapBis = KapVon )) (( KapVonRun = KapVon )) (( KapBisRun = KapBis )) (( TrnKap > 0 )) && (( KapBisRun = KapVonRun )) while (( KapBisRun <= KapBis )) do KapVonRunFil=$( printf "%02d" "${KapVonRun}" ) KapBisRunFil=$( printf "%02d" "${KapBisRun}" ) # bestimme den Dateinamen FilNam="${PreFix}${ErgVlc}_spr_${AudNum}_tit_${TitNum}" (( KapBisRun > 0 )) && FilNam="${FilNam}_kap_${KapVonRunFil}" (( KapVonRun < KapBisRun )) && FilNam="${FilNam}-${KapBisRunFil}" (( SecIst > 0 )) && FilNam="${FilNam}_sec_${SecVon}-${SecBis}" # bestimme die DVD-Positions-Angabe DvdSim="dvdsimple:///${WinDrv}:#${TitNum}" (( KapBisRun > 0 )) && DvdSim="${DvdSim}:${KapVonRun}-${TitNum}:${KapBisRun}" printf "\n\"%s\" \"%s\"\n\n" "${FilNam}" "${DvdSim}" (( TstMod == 0 )) && set -x ${TstKom} /cygdrive/c/Program\ Files\ \(x86\)/VideoLAN/VLC/vlc.exe -I dummy --no-sout-video --sout-audio "--audio-track=${AudNum}" --no-sout-rtp-sap --no-sout-standard-sap --no-sout-all --ttl=1 --sout-keep --sout "${TraVlc},dst=${FilNam}.${ErgVlc}}" "${DvdSim}" ${AddOpt} vlc://quit echo case "${ErgVlc}" in pcm) ${TstKom} ffmpeg -hide_banner -f s16le -ar 48000 -ac 2 -i "${FilNam}.pcm" -ar 48000 -ac 2 "${FilNam}.wav" if (( UseAac == 0 )) then ${TstKom} lame --silent -b 32 -V 0 "${FilNam}.wav" "${FilNam}.mp3" else ${TstKom} ffmpeg -hide_banner -i "${FilNam}.wav" -ac 2 -acodec aac -q:a 2 "${FilNam}.m4a" fi ;; wav) if (( UseAac == 0 )) then ${TstKom} lame --silent -b 32 -V 0 "${FilNam}.wav" "${FilNam}.mp3" else ${TstKom} ffmpeg -hide_banner -i "${FilNam}.wav" -ac 2 -acodec aac -q:a 2 "${FilNam}.m4a" fi ;; ac3) ${TstKom} ffmpeg -hide_banner -i "${FilNam}.ac3" -ac 2 -acodec ac3 -b:a "${BitRat}k" "${FilNam}.m4a" ;; dts) ${TstKom} ffmpeg -hide_banner -i "${FilNam}.dts" -ac 2 -acodec ac3 -b:a "${BitRat}k" "${FilNam}.m4a" ;; esac (( TstMod == 0 )) && set +x echo ${TstKom} ls -l ${FilNam}.* (( TrnKap == 0 )) && break (( KapVonRun += 1 )) (( KapBisRun += 1 )) done


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 33 guests