I used youtube-dl to download and convert youtube video into mp3.

youtube-dl http://www.youtube.com/watch?v=4f51DhJR0zo
-o "Alesso - Think It's Time.flv" -x -f 43 --audio-format mp3

Now it looks like all the mp3 files have an unusual long duration, using amarok, or something similar it will produce very long time interval with no sound. I looked at the flv file, and it seems that the time/duration is right there, but avconv converts and changes the time. So original song.flv duration is 04:42 and output.mp3 duration is 17:20. If i write

$ avconv -i Rihanna\ -\ Diamonds.mp3

output:

Input #0, mp3, from 'Rihanna - Diamonds.mp3': Metadata: encoder : Lavf53.21.1 Duration: 00:04:42.98, start: 0.000000, bitrate: 117 kb/s Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16, 32 kb/s At least one output file must be specified

so duration output is right, but it will not show in amarok. Vlc on the other hand calculates the duration itself, but the time is continuously changing until the song reaches the end.

Is there someway to change global id3_v2 time/duration tags, so I might run a script on all my files after downloading from youtube-dl. Or maybe there is a fix in this bug?

有帮助吗?

解决方案

I've encountered the same issue.

CBR: avconv output bad CBR mp3 headers when using the -ab (or -b:a) option. Outputing to pipe solve this issue:

avconv -i file.flv -b:a 128k --audio-format mp3 - > file.mp3

Note: this fix work only for CBR mp3, it breaks VBR mp3 that needs direct output to file.

VBR: If you use avconv -q:a option (with a 0 to 9 quality indicator), you'll have a VBR mp3 audio stream output:

youtube-dl http://www.youtube.com/watch?v=4f51DhJR0zo
-o "Alesso - Think It's Time.flv" -x -f 43 -q:a 4 --audio-format mp3

With this VBR mp3 output, you can use vbrfix to fix the vbrheader and have a correct duration:

command vbrfix "Rihanna - Diamonds.mp3" "Rihanna - Diamonds - vbrfixed.mp3"

The duration of "Rihanna - Diamonds - vbrfixed.mp3" file should be OK.

Source: http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=7&t=377

Please note that using -ab option with avconv output a CBR mp3 that can't be fixed with vbrfix. Avconv seems to output bad headers for CBR mp3 files.

其他提示

I experienced the same issue. I have used Audacity to do a batch conversion of the files I had downloaded/converted.

Open Audacity directly File->Apply Chain

My version of audacity has supplied "MP3 Conversion" chain. I select this then click the "Apply to files" button.

From there, choose the mp3 files that have the incorrect duration (I just selected all files in my temporary folder)

This creates a "cleaned" sub-directory and opens each file, does a normalisation, then exports to a new mp3 file wit correct duration.

I have not checked all files but it seems to do what I need - it may require more investigation of the normalisation and mp3 export settings are suitable.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top