Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#4494 closed defect (invalid)

Cannot convert MPEG audio to an MP3 file

Reported by: birdie Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: mp3
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

$ ffmpeg -i *mpg -c:a copy out.mp3
ffmpeg version 2.6.2 Copyright (c) 2000-2015 the FFmpeg developers

Input #0, mpeg, from 'out.mpg':
  Duration: 00:03:49.73, start: 0.500000, bitrate: 226 kb/s
    Stream #0:0[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 224 kb/s
[mp3 @ 0x8d65820] Invalid audio stream. Exactly one MP3 audio stream is required.
Output #0, mp3, to 'out.mp3':
  Metadata:
    encoder         : Lavf56.25.101
    Stream #0:0: Audio: mp2, 48000 Hz, stereo, 224 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

At the same time mplayer works just fine:

$ mplayer -dumpaudio *.mpg -dumpfile outputfile.mp3
MPlayer SVN-r37381-4.7.4 (C) 2000-2015 MPlayer Team
210 audio & 441 video codecs

Playing out.mpg.
libavformat version 56.25.101 (internal)
MPEG-PS file format detected.
dump: 6433728 bytes written to 'outputfile.mp3'.
Core dumped ;)

Exiting... (End of file)

Attachments (1)

sample.mpg (830.0 KB) - added by birdie 4 years ago.

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by birdie

comment:1 Changed 4 years ago by birdie

MPEG-1 layer 2 audio is not exactly compliant with the MP3 file extension but most audio players have no troubles playing such audio so I guess ffmpeg should be more relaxed.

comment:2 Changed 4 years ago by cehoyos

  • Keywords mp3 added
  • Resolution set to invalid
  • Status changed from new to closed
  • Version changed from 2.6.1 to unspecified

You can get the exact same output as with MPlayer with the following command line:

$ ffmpeg -i sample.mpg -acodec copy -map 0:a:0 -vn -f rawvideo out.mp3

The output file will of course not be a mp3 file.

A saner command line is:

$ ffmpeg -i sample.mpg -acodec copy -f mp2 out.mp3

comment:3 Changed 4 years ago by birdie

Thanks for the working command(s)!

Note: See TracTickets for help on using tickets.