Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 11 Dec 2017, 15:13
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Use VLC to extract original sound file from youtube video
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [25 Posts]   Goto page: 1, 2 Next
Author Message
nic007


Joined: 13 Nov 2011
Posts: 2198
Location: Cradle of Humankind

PostPosted: Sat 06 Aug 2016, 09:07    Post subject:  Use VLC to extract original sound file from youtube video  

This method is to preserve and download the original sound track of a youtube video, only, without having to convert to another format or bitrate (and lose audio quality). Almost all youtube videos' sound tracks are encoded with the vorbis (ogg) encoder.

Method: Open VLC player > select Media from menu > select Convert/Save > click Network > enter the video url > select Convert at the bottom > In Settings select Convert (should be the default) and for profile select Audio/Vorbis (OGG) > click the edit selected profile button and select the Audio codec tab > tick audio AND tick Keep original audio track > save the settings > enter your destination file and click Start. You do not have to download the video first but if you have already done so, the same method can be followed to extract the original sound file of the video (just add the file path instead of an url).
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 1010
Location: Off Lizard Island for a bit

PostPosted: Sun 07 Aug 2016, 17:30    Post subject:  

I'm wondering why you would want to do that? To collect music maybe? Don't see it so why separate the audio? Maybe to adjust the timing on a video
Back to top
View user's profile Send private message Yahoo Messenger 
mcewanw

Joined: 16 Aug 2007
Posts: 3194
Location: New Zealand

PostPosted: Mon 08 Aug 2016, 04:57    Post subject:  

april wrote:
I'm wondering why you would want to do that? To collect music maybe? Don't see it so why separate the audio? Maybe to adjust the timing on a video


I think, both these reasons you mention are good ones.

In particular, though, despite the move away from simple mp3 players to smartphones, which can play video too, as drivers, we only currently need audio in our car-players (until such time as we all inhabit driverless cars...). Audio takes up much less storage space than video of course. The Times and thus the needs are neverless A'Changing - one day, in the nearish future of huge storage availability and enormous personal computer-power, we might all want and expect 3D... audio and video.

William

_________________
SomeOfMyWork with links:
dCoreDog
weX, scrox, Precord, Premote, fokSyfEyeR, xhippo-mod, flite_hts_pet
Back to top
View user's profile Send private message Visit poster's website 
nic007


Joined: 13 Nov 2011
Posts: 2198
Location: Cradle of Humankind

PostPosted: Mon 08 Aug 2016, 05:35    Post subject:  

april wrote:
I'm wondering why you would want to do that? To collect music maybe? Don't see it so why separate the audio? Maybe to adjust the timing on a video

To download the original youtube soundtrack without any further loss of audio quality and to limit the size of the download. I sometimes want to download some of these album compilations. In many cases these videos consist of a single picture displayed throughout the video (which basically contains only a soundtrack). The audio part of the video may be 100 mb for example whilst the size of the video itself will be much larger, sometimes even double or more the size of the actual soundtrack (even if it contains only one still picture).
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 1010
Location: Off Lizard Island for a bit

PostPosted: Mon 08 Aug 2016, 06:44    Post subject:  

Nah Modern day video compresses very efficiently any video file that contains a series of pictures that remain the same for some seconds so I don't see any point in what you are doing yet.
Back to top
View user's profile Send private message Yahoo Messenger 
nic007


Joined: 13 Nov 2011
Posts: 2198
Location: Cradle of Humankind

PostPosted: Mon 08 Aug 2016, 07:01    Post subject:  

april wrote:
Nah Modern day video compresses very efficiently any video file that contains a series of pictures that remain the same for some seconds so I don't see any point in what you are doing yet.

Then those "modern video compressors" are most definitely NOT used by youtube. Why don't you download a youtube video and extract the audio part to see for yourself (instead of talking bullshit). Oh wait, its you...carry on.
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 1010
Location: Off Lizard Island for a bit

PostPosted: Mon 08 Aug 2016, 07:14    Post subject:  

nic007 wrote:
april wrote:
Nah Modern day video compresses very efficiently any video file that contains a series of pictures that remain the same for some seconds so I don't see any point in what you are doing yet.

Then those "modern video compressors" are most definitely NOT used by youtube. Why don't you download a youtube video and extract the audio part to see for yourself (instead of talking bullshit). Oh wait, its you...carry on.


Still as rude as ever I see and just as neurotic
I left the door open too , I said "yet" , got any more crap?
Back to top
View user's profile Send private message Yahoo Messenger 
nic007


Joined: 13 Nov 2011
Posts: 2198
Location: Cradle of Humankind

PostPosted: Mon 08 Aug 2016, 07:19    Post subject:  

april wrote:
nic007 wrote:
april wrote:
Nah Modern day video compresses very efficiently any video file that contains a series of pictures that remain the same for some seconds so I don't see any point in what you are doing yet.

Then those "modern video compressors" are most definitely NOT used by youtube. Why don't you download a youtube video and extract the audio part to see for yourself (instead of talking bullshit). Oh wait, its you...carry on.


Still as rude as ever I see and just as neurotic
I left the door open too , I said "yet" , got any more crap?

Nah, you are just looking for a shitfight. Cheers
Back to top
View user's profile Send private message 
phat7

Joined: 05 Jun 2015
Posts: 92

PostPosted: Mon 08 Aug 2016, 08:08    Post subject:  

Convert Youtube video to audio file
Back to top
View user's profile Send private message 
nic007


Joined: 13 Nov 2011
Posts: 2198
Location: Cradle of Humankind

PostPosted: Mon 08 Aug 2016, 08:58    Post subject:  

phat7 wrote:
Convert Youtube video to audio file

That is exactly what we want to avoid ie. converting the audio again. With the method described above, the original audio track of the video is downloaded without any further conversion (encoding).
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 1010
Location: Off Lizard Island for a bit

PostPosted: Wed 10 Aug 2016, 06:51    Post subject:  

phat7 wrote:
Convert Youtube video to audio file

Code:
ffmpeg -i video.mp4 -ab 192 out_sound.mp3

"video.mp4" is the name of your video
"out_sound.mp3" is the name of the file that comes out
"-ab 192" I'll have to look up

Works a treat thanks
According to the data in ffmpeg that program has been superceded by avconv and you will find
Code:
avconv -i video.mp4 -ab 192 out_sound.mp3
will give the same result.Its extracted at 128 kbits/sec

Wouldn't credit it but I came across a Russian festival video with slides and fades between that had a 27Meg overall size . I liked the music behind it so decided to try and get it . Used the above after d/l the file as mp4 and got an audio file of 6Meg so there is some to be saved . I wonder though if the fades between slides were not there what size it would be . I'd test it but its too much work.

https://www.youtube.com/watch?v=cYvyjdli8rQ

Code:

# ffmpeg -i video.mp4 -ab 192 out_sound.mp3
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Apr  2 2013 17:00:59 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-08-09 07:46:44
  Duration: 00:06:18.13, start: 0.000000, bitrate: 590 kb/s
    Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 640x360 [PAR 1:1 DAR 16:9], 492 kb/s, 29.87 fps, 30 tbr, 30 tbn, 60 tbc
    Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 95 kb/s
    Metadata:
      creation_time   : 2016-08-09 07:46:46
The bitrate parameter is set too low.It takes bits/s as argument, not kbits/s
Output #0, mp3, to 'out_sound.mp3':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    TDEN            : 2016-08-09 07:46:44
    TSSE            : Lavf53.21.1
    Stream #0.0(eng): Audio: libmp3lame, 44100 Hz, stereo, s16, 0 kb/s
    Metadata:
      creation_time   : 2016-08-09 07:46:46
Stream mapping:
  Stream #0.1 -> #0.0
Press ctrl-c to stop encoding
size=    5909kB time=378.17 bitrate= 128.0kbits/s   
video:0kB audio:5909kB global headers:0kB muxing overhead 0.004313%
# avconv -i video.mp4 -ab 192 out_sound.mp3
avconv version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Apr  2 2013 17:00:59 with gcc 4.6.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-08-09 07:46:44
  Duration: 00:06:18.13, start: 0.000000, bitrate: 590 kb/s
    Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 640x360 [PAR 1:1 DAR 16:9], 492 kb/s, 29.87 fps, 30 tbr, 30 tbn, 60 tbc
    Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 95 kb/s
    Metadata:
      creation_time   : 2016-08-09 07:46:46
File 'out_sound.mp3' already exists. Overwrite ? [y/N] y
The bitrate parameter is set too low.It takes bits/s as argument, not kbits/s
Output #0, mp3, to 'out_sound.mp3':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    TDEN            : 2016-08-09 07:46:44
    TSSE            : Lavf53.21.1
    Stream #0.0(eng): Audio: libmp3lame, 44100 Hz, stereo, s16, 0 kb/s
    Metadata:
      creation_time   : 2016-08-09 07:46:46
Stream mapping:
  Stream #0:1 -> #0:0 (aac -> libmp3lame)
Press ctrl-c to stop encoding
size=    5909kB time=378.17 bitrate= 128.0kbits/s   
video:0kB audio:5909kB global headers:0kB muxing overhead 0.004313%
#
# ffmpeg -i video.mp4 -ab 192 out_sound.mp3
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Apr  2 2013 17:00:59 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-08-09 07:46:44
  Duration: 00:06:18.13, start: 0.000000, bitrate: 590 kb/s
    Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 640x360 [PAR 1:1 DAR 16:9], 492 kb/s, 29.87 fps, 30 tbr, 30 tbn, 60 tbc
    Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 95 kb/s
    Metadata:
      creation_time   : 2016-08-09 07:46:46
The bitrate parameter is set too low.It takes bits/s as argument, not kbits/s
Output #0, mp3, to 'out_sound.mp3':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    TDEN            : 2016-08-09 07:46:44
    TSSE            : Lavf53.21.1
    Stream #0.0(eng): Audio: libmp3lame, 44100 Hz, stereo, s16, 0 kb/s
    Metadata:
      creation_time   : 2016-08-09 07:46:46
Stream mapping:
  Stream #0.1 -> #0.0
Press ctrl-c to stop encoding
size=    5909kB time=378.17 bitrate= 128.0kbits/s   
video:0kB audio:5909kB global headers:0kB muxing overhead 0.004313%
# avconv -i video.mp4 -ab 192 out_sound.mp3
avconv version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Apr  2 2013 17:00:59 with gcc 4.6.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-08-09 07:46:44
  Duration: 00:06:18.13, start: 0.000000, bitrate: 590 kb/s
    Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 640x360 [PAR 1:1 DAR 16:9], 492 kb/s, 29.87 fps, 30 tbr, 30 tbn, 60 tbc
    Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 95 kb/s
    Metadata:
      creation_time   : 2016-08-09 07:46:46
File 'out_sound.mp3' already exists. Overwrite ? [y/N] y
The bitrate parameter is set too low.It takes bits/s as argument, not kbits/s
Output #0, mp3, to 'out_sound.mp3':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    TDEN            : 2016-08-09 07:46:44
    TSSE            : Lavf53.21.1
    Stream #0.0(eng): Audio: libmp3lame, 44100 Hz, stereo, s16, 0 kb/s
    Metadata:
      creation_time   : 2016-08-09 07:46:46
Stream mapping:
  Stream #0:1 -> #0:0 (aac -> libmp3lame)
Press ctrl-c to stop encoding
size=    5909kB time=378.17 bitrate= 128.0kbits/s   
video:0kB audio:5909kB global headers:0kB muxing overhead 0.004313%
#


Last edited by april on Wed 10 Aug 2016, 07:32; edited 1 time in total
Back to top
View user's profile Send private message Yahoo Messenger 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Wed 10 Aug 2016, 07:19    Post subject:  

The ffmpeg (amongst other) methods work to extract the audio, but what nic007 is rightly saying is, it re-encodes the audio to another format and hence you will get degradation.

It may be that the original audio was encoded with enough quality to "survive" yet another encoding with no perceptible deterioration but strictly it is still degrading.
It all depends on what one is playing the resulting audio with.
If it's a smartphone or portable mp3/media player with crappy earphones, I doubt it would make a difference but play it into a good setup with proper full range speakers and the difference is audible.
Not only in frequency response, but dynamic range, inter-modulation and THD as well.

Even if one knows nothing about these terms, the difference is immediately audible to most people when played side by side.

So, if one already has the mp4 and the audio needs to be extracted, the best is still good old PCM (a.k.a. wav) or use a lossless codec like flac, assuming of course that the player can handle those formats.
Also keep in mind that if the original audio in the mp4 is rubbish, converting to pcm or flac is certainly not going to improve it.
It will simply be a case of garbage in, garbage out.

So in the end it comes down to one thing, does it sound good enough?
Everyone is different and if the answer for you is yes, then great, continue.
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 1010
Location: Off Lizard Island for a bit

PostPosted: Wed 10 Aug 2016, 07:37    Post subject:  

Ha Ha thats great explains it well

I got clobbered and destroyed my inner ear bones when I was 5 and only ever remember sound in mono. it makes little difference to me

I guess though with a little crafting, the command could be made to give whatever you want .Flac is one option I have definitely seen in the GUI
Back to top
View user's profile Send private message Yahoo Messenger 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Wed 10 Aug 2016, 07:54    Post subject:  

@april

Sorry to hear about your ear and I hope you are looking after the other one.
Watch those SPL's (Sound Pressure Levels) as modern earphones can give out very high levels which will cause hearing damage over time.

By default, we tend to lose (on average) about 1Khz/10 years of age off the top end (treble frequencies) and sustained exposure to high sound levels will accelerate this.
Back to top
View user's profile Send private message 
nic007


Joined: 13 Nov 2011
Posts: 2198
Location: Cradle of Humankind

PostPosted: Wed 10 Aug 2016, 10:46    Post subject:  

Pete wrote:
The ffmpeg (amongst other) methods work to extract the audio, but what nic007 is rightly saying is, it re-encodes the audio to another format and hence you will get degradation.

It may be that the original audio was encoded with enough quality to "survive" yet another encoding with no perceptible deterioration but strictly it is still degrading.
It all depends on what one is playing the resulting audio with.
If it's a smartphone or portable mp3/media player with crappy earphones, I doubt it would make a difference but play it into a good setup with proper full range speakers and the difference is audible.
Not only in frequency response, but dynamic range, inter-modulation and THD as well.

Even if one knows nothing about these terms, the difference is immediately audible to most people when played side by side.

So, if one already has the mp4 and the audio needs to be extracted, the best is still good old PCM (a.k.a. wav) or use a lossless codec like flac, assuming of course that the player can handle those formats.
Also keep in mind that if the original audio in the mp4 is rubbish, converting to pcm or flac is certainly not going to improve it.
It will simply be a case of garbage in, garbage out.

So in the end it comes down to one thing, does it sound good enough?
Everyone is different and if the answer for you is yes, then great, continue.


Not quite. The audio track in the youtube video is already in a compressed state ie. either ogg vorbis or mp4a. VLC makes it possible to extract the soundtrack exactly as it is. For example: if the soundtrack is 128kb/s in ogg vorbis format, that file will be extracted exactly like that (a 128kb/s .ogg file) without any loss in audio quality. Listening to this file in this format is the best you can do. You can extract to wave from the ogg format whithout further loss of sound quality but then you will sit with a massive file. You can't improve the sound quality of the extracted ogg or mp4a file.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [25 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0799s ][ Queries: 11 (0.0050s) ][ GZIP on ]