6

I want to create an mp3 file from a given mkv file using ffmpeg

the output of ffmpeg -i is as follows

Seems stream 0 codec frame rate differs from container frame rate: 59.94 (2000000/33367) -> 29.97 (30000/1001)
Input #0, matroska,webm, from 'Spiral - 09.mkv':
  Duration: 00:23:09.65, start: 0.000000, bitrate: N/A
    Chapter #0.0: start 0.097000, end 1389.654000
    Metadata:
      title           : 00:00:00.097
    Stream #0.0: Video: h264 (High), yuv420p, 640x428, PAR 1:1 DAR 160:107, 23.98 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0.1(jpn): Audio: aac, 48000 Hz, stereo, s16 (default)
    Stream #0.2: Audio: aac, 48000 Hz, stereo, s16
    Stream #0.3: Subtitle: [0][0][0][0] / 0x0000 (default)

Now I used the following command to create the file. My aim is to get a portion of audio and an image snapshot from the input file and use these as the audio stream and album art for the output file.

ffmpeg -i Spiral\ -\ 09.mkv \
       -map 0:0 -map 0:1\
       -c:v -ss 00:01:30 -vframes 1\
       -c:a:0 mp3 -b:a:0 128k\
       out.mp3

But, I get the following error.

Seems stream 0 codec frame rate differs from container frame rate: 59.94 (2000000/33367) -> 29.97 (30000/1001)
Input #0, matroska,webm, from 'Spiral - 09.mkv':
  Duration: 00:23:09.65, start: 0.000000, bitrate: N/A
    Chapter #0.0: start 0.097000, end 1389.654000
    Metadata:
      title           : 00:00:00.097
    Stream #0.0: Video: h264 (High), yuv420p, 640x428, PAR 1:1 DAR 160:107, 23.98 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0.1(jpn): Audio: aac, 48000 Hz, stereo, s16 (default)
    Stream #0.2: Audio: aac, 48000 Hz, stereo, s16
    Stream #0.3: Subtitle: [0][0][0][0] / 0x0000 (default)
Expected number for vframes but found: 1-c:a:0

Is my way of handling streams correct here? If so, what else could be the problem.

2
  • Please include the complete ffmpeg console outputs and not just segments.
    – llogan
    Oct 16, 2013 at 17:54
  • These are the full output, except for the part where ffmpeg says that this is a deprecated version and asks to use avconv instead
    – Hashken
    Oct 17, 2013 at 8:10

1 Answer 1

6

Maybe you can convert the video to audio with

ffmpeg -i Spiral\ -\ 09.mkv -vn -c:a libmp3lame Spiral\ -\ 09.mp3

then grab the first frame with

ffmpeg -i Spiral\ -\ 09.mkv -vframes 1 cover.jpg

Afterwards, just use a MP3 tagging tool (like EasyTag) to put the cover image in.

1
  • ffmpeg is removed from the repository in 14.04, use avconv instead. Any program that calls ffmpeg by name should work with avconv.
    – rubo77
    Sep 28, 2014 at 8:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .