LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-10-2010, 05:30 AM   #1
sumeet inani
Member
 
Registered: Oct 2008
Posts: 902
Blog Entries: 26

Rep: Reputation: 49
extracting sound clip from video using ffmpeg


I did
Code:
ffmpeg -i Mumbai.Meri.Jaan.2008.1CD.XviD.AC3-5.1.Esub.By.Deejam.avi  -ss 8170 -t 302 bambai-meri-jaan.mp3
FFmpeg version git-1dbd813, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct  1 2010 19:28:12 with gcc 4.4.3
  configuration: '--enable-avfilter' '--enable-avfilter-lavf' '--enable-vdpau' '--enable-bzlib' '--enable-libgsm' '--enable-libschroedinger' '--enable-libspeex' '--enable-libtheora' '--enable-libvorbis' '--enable-pthreads' '--enable-zlib' '--disable-stripping' '--enable-runtime-cpudetect' '--enable-gpl' '--enable-postproc' '--enable-swscale' '--enable-x11grab' '--enable-libdc1394' '--disable-static' '--enable-libopencore-amrnb' '--enable-libopencore-amrwb' '--enable-version3' '--enable-libfaac' '--enable-nonfree' '--enable-libmp3lame' '--enable-libx264' '--enable-gpl' '--enable-libxvid' '--enable-static'
  libavutil     50.23. 0 / 50.23. 0
  libavcore      0. 1. 0 /  0. 1. 0
  libavcodec    52.84. 1 / 52.84. 1
  libavformat   52.77. 0 / 52.77. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.26. 1 /  1.26. 1
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Input #0, avi, from 'Mumbai.Meri.Jaan.2008.1CD.XviD.AC3-5.1.Esub.By.Deejam.avi':
  Metadata:
    ISFT            : AVI-Mux GUI 1.17.7, Aug  8 2006  20:59:17Y
    JUNK            : 
  Duration: 02:21:12.62, start: 0.000000, bitrate: 688 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 672x288 [PAR 1:1 DAR 7:3], 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 128 kb/s
    Metadata:
      strn            : VTS_02_1 T80 3_2ch 128Kbps DELAY 0ms
Output #0, mp3, to 'bambai-meri-jaan.mp3':
    Stream #0.0: Audio: libmp3lame, 48000 Hz, 5.1, s16, 64 kb/s
    Metadata:
      strn            : VTS_02_1 T80 3_2ch 128Kbps DELAY 0ms
Stream mapping:
  Stream #0.1 -> #0.0
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
 
Old 11-10-2010, 05:43 AM   #2
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,145
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
You need to manually set the sampling frequency

Try this:

Code:
ffmpeg -i nodame_theme.flv -ab 128 -ar 44100 nodame_theme.mp3
Quote:
-i is to specified input file, -ab audio bitrate, -ar audio sampling frequency
You can alos use:
Code:
mplayer -dumpaudio  my_video_file.avi -dumpfile extracted_audio.mp3

This technique can be used to extract audio from AVI, MPG and FLV files.

Last edited by prayag_pjs; 11-10-2010 at 05:50 AM.
 
Old 11-10-2010, 05:46 AM   #3
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,125
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
I'd guess it's because libmp3lame doesn't support 6 channel audio, try adding -ac 2
 
1 members found this post helpful.
Old 11-10-2010, 06:10 AM   #4
sumeet inani
Member
 
Registered: Oct 2008
Posts: 902
Blog Entries: 26

Original Poster
Rep: Reputation: 49
You are dead right .
Thank You .
Maybe that is why we should specify -ac , -ab , -ar for output file while using ffmpeg.

BTW , 6 channels was not written anywhere .
How did you tell ?

Last edited by sumeet inani; 11-10-2010 at 06:11 AM.
 
Old 11-10-2010, 05:39 PM   #5
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,125
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
Quote:
Originally Posted by sumeet inani View Post
Code:
Output #0, mp3, to 'bambai-meri-jaan.mp3':
    Stream #0.0: Audio: libmp3lame, 48000 Hz, 5.1, s16, 64 kb/s
That 5.1 is the channels. 5 normal/surround + 1 subwoofer = 6 channels. You might want to try -ac 6 just for kicks and see if that makes libmp3lame happy.

And for the audiophiles out there, I know it's really something like LFE (low frequency effects?) instead of subwoofer but subwoofer is easier for most people to understand

Last edited by estabroo; 11-10-2010 at 05:41 PM. Reason: subwoofer kind of
 
Old 11-15-2010, 06:26 AM   #6
sumeet inani
Member
 
Registered: Oct 2008
Posts: 902
Blog Entries: 26

Original Poster
Rep: Reputation: 49
as prayag_pjs said I ran
Code:
mplayer  -dumpaudio /data/sumeet/video/bollywood/mumbai\ meri\ jaan/Mumbai.Meri.Jaan.2008.1CD.XviD.AC3-5.1.Esub.By.Deejam.avi -ss 8170   -endpos  302 -dumpfile bambai-meri-jaan.mp3
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing /data/sumeet/video/bollywood/mumbai meri jaan/Mumbai.Meri.Jaan.2008.1CD.XviD.AC3-5.1.Esub.By.Deejam.avi.
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
AVI: ODML: Building ODML index (2 superindexchunks).
VIDEO:  [XVID]  672x288  12bpp  23.976 fps  554.8 kbps (67.7 kbyte/s)
Core dumped ;)

Exiting... (End of file)

I got a 135 MB mp3 file.
file  bambai-meri-jaan.mp3 
bambai-meri-jaan.mp3: ATSC A/52 aka AC-3 aka Dolby Digital stream, 48 kHz,, complete main (CM) 3 front/2 rear, LFE on,, 128 kbit/s reserved Dolby Surround mode
But that does not play
mplayer bambai-meri-jaan.mp3 
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing bambai-meri-jaan.mp3.
MPEG-PES file format detected.
demux: File doesn't contain the selected audio or video stream.
MPEG: FATAL: EOF while searching for sequence header.
Video: Cannot read properties.
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
ADecoder init failed :(
ADecoder init failed :(
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
Unknown/missing audio format -> no sound
ADecoder init failed :(
Requested audio codec family [mad] (afm=libmad) not available.
Enable it at compilation.
Opening audio decoder: [hwmpa] MPEG audio pass-through (fake decoder)
Cannot sync MPA frame: 0
ADecoder init failed :(
ADecoder init failed :(
Cannot find codec for audio format 0x50.
Read DOCS/HTML/en/codecs.html!
Audio: no sound
Video: no video


Exiting... (End of file)
Seems ffmpeg is better for transcoding,editing videos.
Mplayer is best for playback.

Last edited by sumeet inani; 11-15-2010 at 06:29 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
extracting a stream from ffmpeg sumeet inani Linux - Newbie 3 11-18-2010 06:41 AM
Recording sound as well as video with FFmpeg and x11grab andrew.46 Slackware 3 06-07-2009 03:00 PM
Need to edit AVI movie clip SOUND ONLY and re-save to original movie clip Balarabay1 Linux - Software 1 02-06-2008 02:49 PM
howto get internet video clip running on sarge stable ? cccc Debian 2 08-13-2006 12:46 PM
Interesting video clip tarballedtux General 5 08-08-2003 03:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration