0

I'm using FFMPEG to Extract audio from an *.avi video file
This is the avi file format printed with ffprobe

ffprobe 0.avi
ffprobe version 2.8.4 Copyright (c) 2007-2015 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --disable-yasm
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
Invalid UE golomb code <-- This line is red in console, it might be an error, but the video plays well
Last message repeated 2 times
Input #0, avi, from '0.avi':
Duration: 00:02:54.33, start: 0.000000, bitrate: 1880 kb/s
Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p, 1280x720, 1740 kb/s, 15 fps, 15 tbr, 15 tbn, 30 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, 1 channels, s16, 128 kb/s

I used ffmpeg command:

ffmpeg -i 0.avi -vn -c:a copy sound0.wav

Convert progress looks ok

Output #0, wav, to 'sound0.wav':
Metadata:
ISFT : Lavf56.40.101
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, mono, 128 kb/s
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
size= 2726kB time=00:02:54.49 bitrate= 128.0kbits/s
video:0kB audio:2726kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.002794%

Output sound information:

Input #0, wav, from 'sound0.wav':
Metadata:
encoder : Lavf56.40.101
Duration: 00:02:54.49, bitrate: 128 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, 1
channels, s16, 128 kb/s

Everything looks ok, but an annoying sounds (just a beep or something like that) comes to end at the audio output file while the input video is fine.

http://vocaroo.com/i/s00Ia5bO0JID

I don't have base knowledge working with Multimedia or ffmpeg, so I have no idea what happened.

Any help would be appreciated.

2 Answers 2

0

Seems the stream copy is copying the entire stream, including the part which extends past the video duration.

Try

ffmpeg -i 0.avi -vn -c:a copy -t 02:54.33 sound0.wav
1
  • Thanks to Mulvya, -t argument temporarily works for me but look like I need to determine the video duration first (from bash script). Is there any other way?
    – Loi Dang
    Jan 15, 2016 at 1:23
0

Maybe that happens because of codec problems. The option -c:a copy copies Audio codec.

use ffmpeg -i 0.avi -c:a libmp3lame sound0.mp3 for encoding your audio to mp3 format.

You must log in to answer this question.

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