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 3rd February 2016
kerasi kerasi is offline
Fdisk Soldier
 
Join Date: Mar 2013
Location: Germany
Posts: 79
Default [solved] mp4 to mp3 and ogg

Hello togehter

i use this to convert .mp4 to .mp3 is this right so?

Code:
   ffmpeg -i 8.mp4 -codec:a libmp3lame -qscale:a 2 song.mp3


how does the syntax look for .ogg???

Last edited by kerasi; 3rd February 2016 at 07:01 PM. Reason: my question was solved
Reply With Quote
  #2   (View Single Post)  
Old 3rd February 2016
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 383
Default

Personally, I use online converters :

https://cloudconvert.com/mp4-to-ogg

or

http://www.clipconverter.cc/
__________________
ThinkPad W500 P8700 6GB HD3650 SSD
ThinkStation P700 2x2620v3 32GB 1050ti SSD 3xHDD
Reply With Quote
  #3   (View Single Post)  
Old 3rd February 2016
kerasi kerasi is offline
Fdisk Soldier
 
Join Date: Mar 2013
Location: Germany
Posts: 79
Default

Hi

thank you for the tip

but i would prefer Manual converting in the shell
Reply With Quote
  #4   (View Single Post)  
Old 3rd February 2016
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Indonesia
Posts: 2,218
Default

Are you sure you want to do this?

mp4, mp3, and vorbis are all "lossy" formats. That means that a certain amount of information is forever lost when compressing it (mp4 can be lossless, though, but it's usually not). This is usually okay, as human hearing can't really notice it. But converting from one lossy encoding to another will reduce audio quality quite a bit. It's like making a copy of a copy with two different copiers that introduce different kinds of errors.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #5   (View Single Post)  
Old 3rd February 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,972
Default

The .mp4 and .ogg filetypes are containers. They may hold multiple tracks of audio and video, and those media tracks may be in a variety of formats -- some are lossy, some lossless.

The .mp3 filetype is not a container, as it only holds one track, an MP3 audio track.

kerasi wants a multimedia file in an .ogg container, but has not specified which audio or video formats are desired.

But ffmpeg discussions aren't specific to this OS. I'm guessing much more detailed guidance can be had from http://ffmpeg.org, as they have their own mailing lists and IRC channels.

Last edited by jggimi; 3rd February 2016 at 04:33 PM. Reason: typos and clarity
Reply With Quote
  #6   (View Single Post)  
Old 3rd February 2016
kerasi kerasi is offline
Fdisk Soldier
 
Join Date: Mar 2013
Location: Germany
Posts: 79
Default

Oh i think i explained it wrong sorry,

my aim is to extract the Audio from an .mp4 file to .mp3 or .ogg which is better in Quality is this wrong?
Reply With Quote
  #7   (View Single Post)  
Old 3rd February 2016
kerasi kerasi is offline
Fdisk Soldier
 
Join Date: Mar 2013
Location: Germany
Posts: 79
Default

for instance a Music Mix .mp4 i will extract the Audio as .mp3 or .ogg to hear it than in my car or when i Play pool.
Reply With Quote
  #8   (View Single Post)  
Old 3rd February 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,972
Default

You've helped, by narrowing the question down to audio, but it is still the wrong question. You are trying to compare apples to styrofoam boxes.

I'll try again. .mp4 and .ogg are containers. Like physical containers -- cans, jars, vats, pots, cups, or barrels, which can hold many different types of things -- you can fill .mp4 or .ogg containers with different types of audio.

What matters is what your audio player can play. It must understand the container, and, it must understand the audio track held within that container.

The .mp4 container supports video, audio and text. Among the many audio formats it permits are AAC, AC3, ALS, SLS, MP3, MP2, ALAC, and several others.

The .ogg container supports video, audio, text, and metadata, and its list of audio formats is different: Speex, Vorbis, Opus, and FLAC.

The .mp3 filetype is not a container. It is only an MP3 audio track.

Last edited by jggimi; 3rd February 2016 at 06:00 PM. Reason: clarity
Reply With Quote
  #9   (View Single Post)  
Old 3rd February 2016
kerasi kerasi is offline
Fdisk Soldier
 
Join Date: Mar 2013
Location: Germany
Posts: 79
Default

ah ok i understand :-)

so jggimi

what shall i do if i have an .mp4 file (a Video with Music) and i will take only the Sound in it and not the Video, to hear it in my car or when i play pool billiard?

PS: i dont know that .ogg Container supports FLAC

so how should the Syntax look for an .mp3 and .ogg extraction from the .mp4 Container?

is that what iam doing the wrong way?

Last edited by kerasi; 3rd February 2016 at 06:43 PM.
Reply With Quote
Old 3rd February 2016
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 605
Default

ffmpeg -i myfile.mp4 -vn myfile.mp3 Should work.

The -i is for in and the -vn is for no VIDEO???? NOOOOOOOOOOOOOOOOOOOOOO!
Or something like that, makes it easy for me to remember.
You can specify the audio codec used if you're not happy with the result, but for most people, the above will be sufficient.

For ogg, I think it's libvorbis, isn't it? (Stops to check). Yeah, so you could use

ffmpeg -i myfile.mp4 -c:a libvorbis myfile.ogg The -codec can be abbreviated to -c.
Reply With Quote
Old 3rd February 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,972
Default

Your player (car, billiards) must understand the container and the audio format you intend to use. As Carpetsmoker recommends, a lossless conversion is better than a lossy conversion, so a lossless codec would be recommended if your player can accept one.

It is possible that your player can understand the audio track in any particular .mp4 file without requiring conversion. If so, you can create an audio-only .mp4 file, with a simple copy. Here's an example where ffmpeg is used. The input file has video (track 0) and audio (track 1) and the output file will have only audio (track 0). This is done with ffmpeg's -map option. which has two fields <file>:<track>. There is only one input file, file 0, and there is only one track mapped, track 1.
Code:
$ ffmpeg -i input.file.mp4 -map 0:1 -c copy output.file.mp4
But, since every .mp4 file can have a different combination of tracks, in different orders, with different audio/video formats, the only way to know what is in your input file is to inspect it. You can use ffprobe.

Be careful with using the .m4a filetype. There is no difference in the .mp4 and .m4a containers, even though they have different filetypes. .m4a was first used by Apple for .mp4 audio-only files using AAC or ALAC codecs. Some audio-only players may accept files with .m4a in their names, but refuse to play the same fle if it uses .mp4, even though the files themselves are identical. If a player will accept .m4a, but will refuse .mp4, use the .m4a filetype for audio-only .mp4 files.
Reply With Quote
Old 3rd February 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,972
Default

I use ffmpeg frequently, and primarily to switch containers. I often need to convert multimedia files from the Matroska container (.mkv) to .mp4, because I have a media player that does not understand the Matroska container. The underlying video and audio tracks are usually in formats the player understands, so I merely copy from one container to the other, with something as simple as $ ffmpeg -i in.mkv -c copy out.mp4

Last edited by jggimi; 3rd February 2016 at 06:34 PM. Reason: typo, clarity
Reply With Quote
Old 3rd February 2016
kerasi kerasi is offline
Fdisk Soldier
 
Join Date: Mar 2013
Location: Germany
Posts: 79
Default

wauhhhh cool many thanks to all :-)

i love that to work with the Shell and not with a gui although it is not so comfortable

PS: my car unfortunately my Radio is an BMW Business dont understand .mp3 i burn this on a Audio cd, but my smart phone understands .ogg

thank you all
Reply With Quote
Old 3rd February 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,972
Default

Quote:
but my smart phone understands .ogg
That's like me saying that I drink from cups. It doesn't tell you much about my beverage choices.

There are 5 audio formats available for the .ogg container. Your smartphone's audio player application may support all of them. Or perhaps only one.

Lossless: PCM, FLAC
Lossy: Speex, Vorbis, Opus.

As I stated above, it is possible that your player also support .mp4 containers, and may also understand some of the many audio formats used within. Those audio tracks may be copied -- not converted -- to an audio only .mp4 container. But the audio player may refuse to play them unless the file name ends with ".m4a".

Last edited by jggimi; 3rd February 2016 at 07:25 PM. Reason: missed quote
Reply With Quote
Old 3rd February 2016
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,343
Default

Code:
ffmpeg -i video.mp4 -b:a 192K -vn music.mp3
This extracts the audio from an mp4 video with a bitrate of 192K. You can adjust the bitrate or use a variable bitrate.
Reply With Quote
Old 3rd February 2016
kerasi kerasi is offline
Fdisk Soldier
 
Join Date: Mar 2013
Location: Germany
Posts: 79
Default

I'am so happy that i have you all here with that knowledge and the Patience to help me :-)

PS: i hope my english is not so bad (iam greek) who lives in Germany :-)
Reply With Quote
Old 3rd February 2016
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,343
Default

My understanding is that ffmpeg can produce *.ogg output but the quality is poor. Libvorbis produces better quality ogg files and can be specified when invoking ffmpeg
From convert-video-file-to-ogg
Quote:
You can simply run this to do the conversion.

ffmpeg -i neha.avi -acodec libvorbis output.ogg
Dont bother to put any options for bitrate or aspect ratio. It will choose for itself. You can set the max audio bitrate to 192000 (or whatever value you want, upto 320000 AFAIK) by adding -ab 192000 anywhere in the command. Also, you set the video bitrate at say, 1200kb (or any other value), by including -b 1200kb in the command.

So here is the command in the end, (the order of options dont matter, since you asked. nothing to worry)

ffmpeg -i neha.avi -acodec libvorbis -ab 192000 -b 1200kb output.ogg
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


All times are GMT. The time now is 12:40 PM.


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