Results 1 to 5 of 5

Thread: Extracting audio from video?

  1. #1
    Join Date
    Oct 2008
    Beans
    11

    Extracting audio from video?

    How can I extract (not reconvert) an audio source from a video file?

    For exmaple,

    video.mp4 [motionPicture.mp4 (H264) + audioSource.aac]
    -> audioSource.aac

    I've tried

    $ffmpeg -i video.mp4 audio.aac # Not good. This is recompressed and losing the quality even more!

    $ffmpeg -i video.mp4 audio.flac
    # Ok, but resulting bigger file size. Lossy to lossless sounds stupid.

    $mplayer -dumpaudio video.mp4 -dumpfile audio.aac
    # It doesn't work (and I don't know how it actually works.) Why??

    If you have any idea, please advise. Thanks.

  2. #2
    Join Date
    Jul 2006
    Location
    Lancashire
    Beans
    Hidden!
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Extracting audio from video?

    Hi
    These commands are OK:-

    Code:
    ffmpeg -i video.mp4 -vn -acodec copy audio.aac
    or
    Code:
    ffmpeg -i video.mp4 -vn -acodec copy audio.m4a

  3. #3
    Join Date
    Oct 2010
    Location
    London
    Beans
    481
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Extracting audio from video?

    ffmpeg -i input.mp4 -vn -acodec copy output.aac

    The '-acodec copy' tells ffmpeg to copy the audio stream without converting; '-vn' isn't strictly necessary if you want to use AAC as the format, it tells ffmpeg to strip out the video, but since AAC is a purely audio format the program will do that automatically. If you want to be able to add metadata tags, you should use MP4 or M4A (some portable devices can play M4A but not MP4, even though they are actually the same container format but with different file extensions).

    Also, if you want to put in metadata with ffmpeg, here is a guide.

  4. #4
    Join Date
    Jan 2009
    Location
    Nelspruit, South Africa
    Beans
    1,416
    Distro
    Ubuntu Development Release

    Re: Extracting audio from video?

    audacity
    Monitor: LG flatron w1954s 22", mobo: G31-m7 series, CPU: Intel LGA 775 Intel core duo 2 2,66GHZ, RAM: 3GB, GPU: ATI Radeom HD 2400, Storage: 500GB SATA and 80GB IDE, Windows 7 ultimate and Ubuntu

  5. #5
    Join Date
    Oct 2008
    Beans
    11

    Re: Extracting audio from video?

    Awesome,
    ffmpeg -i video.mp4 -vn -acodec copy audio.aac
    worked! I can't tell the difference between audio.aac and audio.flac though the first one has much smaller file size. Thank you, ron999! : )

    To: evilsoup
    Thank you so much for explaining it in detail. I will study more : )

    To: elliotn
    I haven't thoguht about that. That sounds more human-friendly! Thanks : )

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •