Any s/w to cut/add audio files, convert video to audio?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Any s/w to cut/add audio files, convert video to audio?
I have below 2 queries please:
a) There are audio files from where I want to cut some portions. for ex.
Suppose there is 30 minutes audio file. I want to extract audio from
5 minutes to 8 minutes and from 20 minutes to 24 minutes.
Then I want to add these 2 extractions;i.e. it w'd become 7 minutes
continues audio [(8-5) + (24-20) = 7 minutes ]
b) Also, I want to extract from one video file only audio matter, i.e. convert video to audio.
I searched a lot in google a few months back when I was using Windows7.
Now I am working on ubuntu13.04.
(for my solution, command line from terminal is more preferred)
ffmpeg -ss 00:05:00 -t 00:03:00 -i inputfile -acodec copy outputfile1.ext
ffmpeg -ss 00:20:00 -t 00:04:00 -i inputfile -acodec copy outputfile2.ext
To combine
sox outputfile1.ext outputfile2.ext final.ext
To extract audio only from a video
ffmpeg -i inputfile -vn output.mp3
the -ss tells ffmpeg to start at 5 mins in the audio and encode up to 3 mins with the -t option.
inputfile is the source file and outputfile.ext is the output file and extension you desire it to be.
lastly, the -vn tells ffmpeg to rip audio only minus the video.
Thanks for your valuable input. But I faced issue. I got the below error when executed the command to rip audio from video.
Code:
ravbholua@ravbholua-Aspire-5315:~$ ffmpeg -i ./Mus*/14082012205--.mp4 -vn check.mp3
ffmpeg version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
built on Mar 30 2013 22:23:21 with gcc 4.7.2
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 15.00 (15/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './Music/14082012205--.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp423gp4isom
creation_time : 2012-08-14 17:02:54
Duration: 00:27:58.28, start: 0.000000, bitrate: 813 kb/s
Stream #0.0(und): Video: mpeg4 (Simple Profile), yuv420p, 352x288 [PAR 1:1 DAR 11:9], 763 kb/s, 13.57 fps, 15 tbr, 30k tbn, 30k tbc
Metadata:
creation_time : 2012-08-14 17:02:54
Stream #0.1(und): Audio: aac, 16000 Hz, mono, s16, 48 kb/s
Metadata:
creation_time : 2012-08-14 17:02:56
Output #0, mp3, to 'check.mp3':
Stream #0.0(und): Audio: [0][0][0][0] / 0x0000, 16000 Hz, mono, s16, 200 kb/s
Metadata:
creation_time : 2012-08-14 17:02:56
Stream mapping:
Stream #0.1 -> #0.0
Encoder (codec id 86017) not found for output stream #0.0
ravbholua@ravbholua-Aspire-5315:~$
Then I changed the output file extension to .wav and it worked.
But here the problem is the file size of the output file is 54 MB. For nearly 28 minutes audio, 54 MB is very much. I have many files of .amr extensions whose sizes are only 1 MB for the same amount of time. When I give the output file name as .amr extension, it shows the same error.
There mp3 was mentioned in the output. A part of the output is as below:
Code:
D A D mp3 MP3 (MPEG audio layer 3)
D A D mp3adu ADU (Application Data Unit) MP3 (MPEG audio layer 3)
D A D mp3adufloat ADU (Application Data Unit) MP3 (MPEG audio layer 3)
D A D mp3float MP3 (MPEG audio layer 3)
D A D mp3on4 MP3onMP4
D A D mp3on4float MP3onMP4
Quote:
Originally Posted by matrixworld
Also, did you install the ubuntu restricted extras package, This includes the codecs for playing and encoding multimedia files.
I haven't installed the ubuntu restricted extras package. Please share how to install.
Thanks for the info. It worked for me. But some issues I w'd like to address.
1) After running the above command, after some time a window popped up mentioning "end user aggrement". I scrolled down. in bottom 'OK' was written but clicking it doesn't result in anything. I pressed enter and nothing happened. I did wait for 30 minutes but the same window was in screen and didn't proceed ahead. Then I opened another terminal and via ps -ef command, killed the window. Then the other terminal command proceeded ahead. Please see the result in the screen shot attached. Later I got a message from ubuntu saying that something wasn't isntalled and I clicked "install now" in that message to install the remaining.
2)The command which wasn't earlier working now worked. Please have a look below:
The output file check1.mp3 created having size of 33.6 MB. But again the same issue of size. You also can understand this is a big size for 28 minutes audio. It's better than .wav file which consumes 54 MB. But still this audio should't be more than 1 MB. The .amr file takes only 1MB. Please see the output of the command when the output file is .amr. This time it hasn't given the previous error (earlier it was saying :no encoder found). But a diff. error. Please see if you can say a solution.
I'm not familiar with amr and its compression scheme. An mp3 file will be larger than amr format.
An average sample rate of 128k will produce 1MB per minute. For example a 4 minute song at 128k will have a file size of around 3 to 5 megabytes.
Your 33MB file is just about average for a 28 minute audio. You can however lower the file size by adjusting the sample and bit rates. Fair warn, the lower the sample and bit rate, the audio quality will degarde as well.
The last one tells ffmpeg to keep the file size to around 5MB or less using the -fs option. If the length of the audio is too long to fit at 5M, it may go over the 5MB size.
As for sox, I don't think amr is supported. I also tried to convert a wav file to amr and got the same error as well. However, it does support mp3 files as I've use it sometimes to combine mp3 files together.
Last edited by matrixworld; 08-27-2013 at 04:11 PM.
As for sox, I don't think amr is supported. I also tried to convert a wav file to amr and got the same error as well. However, it does support mp3 files as I've use it sometimes to combine mp3 files together.
Thanks for your very valuable info.
Yes you may be right, then it may be a problem from my side which I didn't mention in my last post. That is, the 2 .mp3 files that I was trying to add using "sox" were made from .amr files as shown below:
I only had amr files which didn't work with 'sox'. so I converted them to mp3 as above and ran sox. So, what you say, the resultant output file from the above commands (out1.mp3 and out2.mp3) aren't really .mp3 files??? If they are, then sox should run on them!!!
Last edited by ravisingh1; 08-27-2013 at 10:28 PM.
If you get any errors from avconv or sox, than it's possible the culprit is the mp4 file. It may have something that avconv doesn't recognize or the file is bad or some unknown reason.
Last edited by matrixworld; 08-28-2013 at 12:04 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.