5

When I use Thunar I like adding to custom actions command lines like those presented here, here and here to extract audio from videos. I mean without transcoding/altering the sound, just putting it out of the video (a flv or mp4 video, for example, is a aac audio - which cannot be played as such, but rapped into a m4a, like in the the command in the links posted. a webm video has a ogg audio which needs to be extracted.)

Now, I am using elementayOS, and will not use Thunar, nor Nautilus, just Pantheon-Files.

I want to know if there is a GUI solution to achieve this.

3
  • to do that in terminal: avconv -i "INPUT FILE" -map 0:1 -c:a copy "OUTPUT FILE". it is fast - instant!
    – user32012
    Oct 5, 2013 at 1:01
  • avconv is a forked project from ffmpeg: stackoverflow.com/questions/9477115/…. You can do the exact same thing as I've described in my answer too.
    – slm
    Oct 5, 2013 at 17:22
  • @slm - i got myself an answer by using avconv commands with nautilus actions
    – user32012
    Oct 5, 2013 at 17:56

5 Answers 5

5

Command line

If you're willing to forgo using a GUI you can use ffmpeg fairly easily to do this.

Sample file

If you go to QuickTime: Sample files, you can download this sample file, sample_mpeg4.mp4. After downloading it, unzip it.

$ ls -l | grep sample
-rw-rw-r-- 1 saml saml   235829 Nov  4  2005 sample_mpeg4.mp4.zip
-rw-r--r-- 1 saml saml   245779 Nov  3  2005 sample_mpeg4.mp4

Example

You can extract the AAC audio frpm the mP4 file.

$ ffmpeg -i sample_mpeg4.mp4 -vn -acodec copy sample_mpeg4.aac
FFmpeg version 0.6.3-rpmfusion, Copyright (c) 2000-2010 the FFmpeg developers
  built on May  5 2011 19:20:01 with gcc 4.5.1 20100924 (Red Hat 4.5.1-4)
...
...
Output #0, adts, to 'sample_mpeg4.aac':
  Metadata:
    encoder         : Lavf52.64.2
    Stream #0.0(eng): Audio: aac, 32000 Hz, stereo, 48 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
size=      31kB time=4.99 bitrate=  50.4kbits/s    
video:0kB audio:30kB global headers:0kB muxing overhead 3.594943%

The resulting AAC file.

$ ls -l |grep sample
-rw-rw-r-- 1 saml saml    31468 Oct  4 22:09 sample_mpeg4.aac
-rw-r--r-- 1 saml saml   245779 Nov  3  2005 sample_mpeg4.mp4
-rw-rw-r-- 1 saml saml   235829 Nov  4  2005 sample_mpeg4.mp4.zip

You can also use ffmpeg to confirm the file format:

$ ffmpeg -i sample_mpeg4.aac 
...
...
Input #0, aac, from 'sample_mpeg4.aac':
  Duration: 00:00:05.59, bitrate: 45 kb/s
    Stream #0.0: Audio: aac, 32000 Hz, stereo, s16, 45 kb/s
At least one output file must be specified

GUI

You can use VLC and it's Convert/Stream feature to do this. After launching VLC.

Example

Select Convert/Save from File pulldown

           ss #1

Select video file, and convert stream

           ss #2

Start the conversion

           ss #3

12
  • @cipricus - AAC and WEBM are there.
    – slm
    Oct 4, 2013 at 23:34
  • @cipricus - no I am not positive, I would double check the dump raw input option, also poke around the options menu under the screwdriver/plyer icon next to audio.
    – slm
    Oct 5, 2013 at 0:12
  • 1
    See here: wiki.videolan.org/Extract_audio
    – slm
    Oct 5, 2013 at 0:17
  • sorry. in fact the only audio output options are: mp3, ogg, mp3 (mp4), flac, cd. so, no solution aac-m4a for flv and mp4 videos (youtube). (where is AAC?) webm is ogg audio. but there seems to be transcoding anyway as there's an option to set the bitrate. trying to output webm as ogg i got nothing anyway
    – user32012
    Oct 5, 2013 at 0:21
  • I'm not sure where the codecs for VLC come from, they might need to be installed separately.
    – slm
    Oct 5, 2013 at 0:23
5

Better than trying to add context menu commands to the minimalist Pantheon-Files of Elementary OS or to use other media applications to extract sound from video, I guess the most simple is just to install Nautilus (it is not at all problematic in eOS, contrary to Thunar, which comes with the whole Xfce environment).

sudo apt-get install nautilus

Then install Nautilus-Actions Configuration Tool and open it..

I will provide an example for extracting audio (aac in m4a container) from flv and mp4 video files.

Define a new action, give it a name, maybe an icon too. Check - 'Display action in selection context menu'.

enter image description here

Under the command tab, add the command

bash -c 'ffmpeg -i "$0" -map 0:1 -c:a copy "${0%%.*}".m4a' %f.

enter image description here

Under Execution tab there are options to select depending on what you want to see during and after the action (open terminal, report).

Under Mimetypes tab, enter the filters for the type of files in the context menu of which you want to see the command - in this case: video/mp4 and video/flv.

enter image description here

There are other options, but these look sufficient for the purpose of my question.

enter image description here

Similar actions can be added to extract sound from other types of video and, of course, for other very different purposes.

(This solution is based on suggestions and solutions present in the links already posted in the question and the credit goes to the authors.)


Can be used in Thunar custom actions too.

My initial source is this.

0

I have good solution :

#!/bin/bash 
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
    find $1 -iname "*" -a -type f  -exec ffmpeg -y -i {}  {}.mp3   \;
# restore $IFS
IFS=$SAVEIFS

You should call :

./myscript.sh youroootpathofvideos
1
  • 1
    i was asking for GUI (graphical not terminal) commands. and not to convert to mp3, but to extract audio as such
    – user32012
    Oct 5, 2013 at 16:34
0

I was surprised how hard it is to find a good tool for this, but here's my choice:

FFmulticonverter is a very basic gui for avconv/ffmpeg. You can Put files in with drag&drop and optionally save the Outfiles in their original location - that makes it very fast for me.

and you can just use the code:

-vn -acodec copy like in avconv -i INPUT.mp4 -vn -acodec copy OUTFILE.m4a

There's presets for it but at the moment it uses .aac as file-extension and i suggest you use .m4a.

-1

Losslesscut

Select "tracks" section

enter image description here

Identify the audio track to extract as separate file.

enter image description here

You must log in to answer this question.