DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 29th December 2014
kerasi kerasi is offline
Shell Scout
 
Join Date: Mar 2013
Location: Germany
Posts: 90
Default ffmpeg select and extract 1 audio stream

Hello

i have ripped some dvd and have them now in differernt formats like mp4,mov,m4v,vob

i will extract only the audio because i will listen them in my car or when playing pool.

I have the movie Miss Marple Murder She Said which is in a .m4v format and has 2 audio streams 1 english and 1 german.

So when i type

ffmpeg -i murder_she_said.m4v i get the 2 streams as

0:1 englisch
0:2 german

so what do i have to type to get the german stream in high quality?

the other movie i own is The Color of Money with Tom Cruise this file is an mp4, what do i have to type there to get the german audio stream in best quality?

the last movie is The Fearless Vampires with Roman Polanski which is a .vob file?

many thanks in advance
Reply With Quote
  #2   (View Single Post)  
Old 29th December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 653
Default

I have a whole page about this sort of thing.
http://srobb.net/dvds.html

I go into more detail in the section about removing unwanted audio. but in brief

In this case the map command ought to do it.
ffmpeg -i movie.m4v -map 0:0 -map 0:2 germanfile.m4v.

The first 0 is the input file (movie.m4v in this example) and second number is the stream, so 0:0 would be map input files 0 stream, the video, 0:2 would be map the input file's 3 stream, the German audio.


I deal with vob files there too, though I often just give up and use HandBrake on them. If it were me, I'd first convert the vob into an mp4, then run ffprobe to see the tracks. (Or maybe convert to an mkv and user mkvmerge --identify to see the tracks.) Again, I cover all this on the page listed above,
Reply With Quote
  #3   (View Single Post)  
Old 29th December 2014
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

Quote:
Originally Posted by scottro View Post
I have a whole page about this sort of thing.
http://srobb.net/dvds.html
Boy you are something

Here is what I usually do

Code:
#crop detect
mplayer dvd://2 -vf cropdetect
       
# Widescreen: use scale "704:304"  Fullscreen: use scale "640:480" (see below) 

# Encode DVD title #2, only selected chapters:
mencoder dvd://2 -chapter 10-15 -o title2.avi -oac copy -ovc lavc
-lavcopts vcodec=mpeg4

#Two passes encoding
mencoder dvd://2 -chapter 1-21 -ovc lavc -lavcopts \
vcodec=mpeg4:vpass=1 -oac copy -o /dev/null ;
mencoder dvd://2 -chapter 1-21  -ovc lavc -lavcopts \
vcodec=mpeg4:mbd=2:trell:vpass=2  -oac copy -o output.avi

       
# transfering the movie into mpg2
ffmpeg -i title2.avi -y -target ntsc-dvd -sameq -aspect 16:9 finalmovie.mpg

# Creating the movie
dvdauthor --title -o dvd -f finalmovie.mpg


# Creating the title
dvdauthor -o dvd -T


#making DVD structure
mkisofs -dvd-video -o dvd.iso dvd/

#burning the movie
growisofs -dvd-compat -Z /dev/rcd0c=dvd.iso
Reply With Quote
  #4   (View Single Post)  
Old 30th December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 653
Default

Hey Oko, would you be OK with me linking to that? Something like, (and if you didn't like the final wording, I'd change it, but off the top of my head), after the part where I say how my page is haphazard, something like, for some quick and simple solutions to common multimedia tasks, see this post by user Oko on daemon forums (with a link in there.)

If you'd rather not, I understand of course, but if you are OK with it, let me know. (And if you had wording you would prefer, let me know that too.)

Thanks for reading, regardless of your answer.
Reply With Quote
  #5   (View Single Post)  
Old 30th December 2014
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

@scottro
Of course pal. Feel free to link as you please
Reply With Quote
  #6   (View Single Post)  
Old 30th December 2014
kerasi kerasi is offline
Shell Scout
 
Join Date: Mar 2013
Location: Germany
Posts: 90
Default

Wauhh !!! thank you very much for that help
Reply With Quote
  #7   (View Single Post)  
Old 30th December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 653
Default

@Oko, thanks. I'll let you know when it's done.

EDIT:
Thanks again, Oko, it's been done, let me know if there's anything about the wording that you'd like changed. (Leaving for work in a few, so changes might not be till this evening, EST).

Last edited by scottro; 30th December 2014 at 11:13 AM.
Reply With Quote
  #8   (View Single Post)  
Old 30th December 2014
kerasi kerasi is offline
Shell Scout
 
Join Date: Mar 2013
Location: Germany
Posts: 90
Default

hello

it don t work for me :-(

i have Murder_She_Said.m4v

and when i type

Code:
ffmpeg -i  Murder_She_Said.m4v -map 0:0 -map 0:2 -target Murder_She_Said.m4v murder.mp3
0:0 is the video stream h264
0:2 is the german stream

when i try this

Code:
ffmpeg -i Murder_She_Said.m4v -map 0:0 -map 0:2 -c copy murder.mp3
result is

murder.mp3 no such file or directory

Last edited by kerasi; 30th December 2014 at 04:13 PM.
Reply With Quote
  #9   (View Single Post)  
Old 30th December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 653
Default

mp3 will just be the audio, that's what you want?
Try
Code:
ffmpeg -i myfile.m4v -map 0:2 murder.mp3
should work. (Untested by me though.)


http://howto-pages.org/ffmpeg/#strip

talks about stripping audio or video from the file.
Reply With Quote
Old 30th December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 653
Default

Also, if all you want is the audio, you can use -vn to show that you don't want video.
Reply With Quote
Old 30th December 2014
kerasi kerasi is offline
Shell Scout
 
Join Date: Mar 2013
Location: Germany
Posts: 90
Default

it dont work

this is the file

-rwxr-xr-x 2 root wheel 1141658110 Feb 3 2012 Murder_She_Said.m4v

i try this

Code:
ffmpeg -i myfile.m4v -map 0:2 murder.mp3
and i get this

Code:
ffmpeg version git-N-66360-gd61454e Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec 14 2014 09:46:55 with clang version 3.5 (trunk)
  configuration: --enable-libx265 --enable-shared --arch=amd64 --cc=cc --disable-altivec --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-debug --disable-iconv --disable-indev=jack --disable-indev=oss --disable-lzma --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --disable-neon --disable-outdev=oss --disable-outdev=sdl --disable-vfp --enable-avresample --enable-gpl --enable-libgsm --enable-libmp3lame --enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-nonfree --enable-openssl --enable-x11grab --extra-cflags='-I/usr/local/include -I/usr/X11R6/include' --extra-libs='-L/usr/local/lib -L/usr/X11R6/lib' --mandir=/usr/local/man --optflags='-O2 -pipe -Wno-redundant-decls'
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Murder_She_Said.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2012-02-03 16:27:35
    encoder         : HandBrake 0.9.5 2011043000
  Duration: 01:22:23.83, start: 0.000000, bitrate: 1847 kb/s
    Chapter #0.0: start -0.184011, end 132.424011
    Metadata:
      title           : Chapter  1
    Chapter #0.1: start 132.424011, end 266.904011
    Metadata:
      title           : Chapter  2
    Chapter #0.2: start 266.904011, end 528.024011
    Metadata:
      title           : Chapter  3
    Chapter #0.3: start 528.024011, end 776.584011
    Metadata:
      title           : Chapter  4
    Chapter #0.4: start 776.584011, end 977.904011
    Metadata:
      title           : Chapter  5
    Chapter #0.5: start 977.904011, end 1177.024011
    Metadata:
      title           : Chapter  6
    Chapter #0.6: start 1177.024011, end 1502.344011
    Metadata:
      title           : Chapter  7
    Chapter #0.7: start 1502.344011, end 1848.224011
    Metadata:
      title           : Chapter  8
    Chapter #0.8: start 1848.224011, end 2221.664011
    Metadata:
      title           : Chapter  9
    Chapter #0.9: start 2221.664011, end 2453.464011
    Metadata:
      title           : Chapter 10
    Chapter #0.10: start 2453.464011, end 2639.044078
    Metadata:
      title           : Chapter 11
    Chapter #0.11: start 2639.044078, end 2888.644078
    Metadata:
      title           : Chapter 12
    Chapter #0.12: start 2888.644078, end 3042.244078
    Metadata:
      title           : Chapter 13
    Chapter #0.13: start 3042.244078, end 3227.284078
    Metadata:
      title           : Chapter 14
    Chapter #0.14: start 3227.284078, end 3378.004078
    Metadata:
      title           : Chapter 15
    Chapter #0.15: start 3378.004078, end 3612.284078
    Metadata:
      title           : Chapter 16
    Chapter #0.16: start 3612.284078, end 3891.404078
    Metadata:
      title           : Chapter 17
    Chapter #0.17: start 3891.404078, end 4128.684078
    Metadata:
      title           : Chapter 18
    Chapter #0.18: start 4128.684078, end 4395.204078
    Metadata:
      title           : Chapter 19
    Chapter #0.19: start 4395.204078, end 4536.404078
    Metadata:
      title           : Chapter 20
    Chapter #0.20: start 4536.404078, end 4795.324078
    Metadata:
      title           : Chapter 21
    Chapter #0.21: start 4795.324078, end 4905.844078
    Metadata:
      title           : Chapter 22
    Chapter #0.22: start 4905.844078, end 4943.828089
    Metadata:
      title           : Chapter 23
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 718x576 [SAR 64:45 DAR 718:405], 1531 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2012-02-03 16:27:35
      encoder         : JVT/AVC Coding
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 143 kb/s (default)
    Metadata:
      creation_time   : 2012-02-03 16:27:35
    Stream #0:2(deu): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 159 kb/s
    Metadata:
      creation_time   : 2012-02-03 16:27:35
    Stream #0:3(eng): Subtitle: dvd_subtitle (mp4s / 0x7334706D), 720x576, 3 kb/s (default)
    Metadata:
      creation_time   : 2012-02-03 16:27:35
    Stream #0:4(deu): Subtitle: dvd_subtitle (mp4s / 0x7334706D), 720x576, 2 kb/s
    Metadata:
      creation_time   : 2012-02-03 16:27:35
    Stream #0:5(und): Subtitle: mov_text (text / 0x74786574)
    Metadata:
      creation_time   : 2012-02-03 16:27:35
murder.mp3: No such file or directory
what is wrong?
Reply With Quote
Old 30th December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 653
Default

Might be that you don't have the audio codec. If all you want is the audio, you shouldn't need the map option.

Run
Code:
 ffmpeg -codecs |grep mp3
Assuming you get something back, then try

Code:
 ffmpeg -i myfile -vn -acodec mp3 myfile.mp3
(Change myfile to the proper names).
Reply With Quote
Old 30th December 2014
kerasi kerasi is offline
Shell Scout
 
Join Date: Mar 2013
Location: Germany
Posts: 90
Default

it works :-) :-)

i try this

Code:
ffmpeg -i Murder_She_said.m4v -map 0:2 -acodec mp3 -ab 192k murder.mp3
the problem was that i had this movie on my external drive which i mounted but when i mv the file to my home user account it works oh mannnnnn i was to .......

is that code ok to have good quality? because if i typed it without bitrate it was extract as 64kbit
Reply With Quote
Old 30th December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 653
Default

I'm not an expert on audio at all. If the quality sounds good to you, then great--if not, I would just google ffmpeg audio quality. Depending upon what you're using to hear it the difference in quality may not be noticeable.
Reply With Quote
Old 30th December 2014
kerasi kerasi is offline
Shell Scout
 
Join Date: Mar 2013
Location: Germany
Posts: 90
Default

and many thanks iam so happy :-)
Reply With Quote
Old 30th December 2014
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

Quote:
Originally Posted by kerasi View Post
it works :-) :-)

i try this

Code:
ffmpeg -i Murder_She_said.m4v -map 0:2 -acodec mp3 -ab 192k murder.mp3
the problem was that i had this movie on my external drive which i mounted but when i mv the file to my home user account it works oh mannnnnn i was to .......
You can use absolute paths...
Code:
ffmpeg -i /path/to/your/movie.m4v ...
Using absolute paths is just part of how the shell works and is in no way exclusive to ffmpeg.

Quote:
Originally Posted by kerasi View Post
is that code ok to have good quality? because if i typed it without bitrate it was extract as 64kbit
That gives you a bitrate of 192kbps. That should be more than sufficient for most audio equipment (and most human ears). Mp3 can go as high as 320kbps but that's really a lot of extra HDD space for little audible gain.
Reply With Quote
Old 30th December 2014
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

Quote:
Originally Posted by kerasi View Post
is that code ok to have good quality? because if i typed it without bitrate it was extract as 64kbit
People who are concern with good quality audio don't use lossy compressed audio formats like MP3. What does it happen when you try to extract your audio into FLAC files? Can you notice a difference on your audio equipment?
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
azalia Intel SCH HD Audio strange audio issues tehsean OpenBSD General 3 26th August 2012 12:21 AM
How to select all in vi? guitarscn General software and network 13 15th December 2010 06:15 PM
Why I can't select language from gdm? fender0107401 OpenBSD General 6 11th May 2010 11:09 PM
scompat extract failed rtwingfield FreeBSD Ports and Packages 2 22nd June 2009 05:15 PM
Extract ISO under OpenVZ virtual machine stukov Other BSD and UNIX/UNIX-like 1 14th May 2008 09:46 PM


All times are GMT. The time now is 01:26 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick