Monday, 28 August 2017

ffmpeg - converting video to audio OGG results in wrong metadata duration


I'm converting mpeg video to ogg audio file using -vn option:


ffmpeg -i video.avi -acodec libvorbis -vn sound.ogg


The output:


ffmpeg -i video.avi -acodec libvorbis -vn -y sound.ogg
ffmpeg version 0.8, Copyright (c) 2000-2011 the FFmpeg developers
built on Jun 23 2011 14:21:12 with gcc 4.5.3
configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 9. 1 / 51. 9. 1
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 4. 0 / 53. 4. 0
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 23. 0 / 2. 23. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, avi, from 'video.avi':
Metadata:
encoder : Lavf54.25.105
Duration: 00:00:10.03, start: 0.000000, bitrate: 269 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 505x404 [PAR 1:1 DAR 5:4], 25 tbr, 25 tbn, 25 tbc
Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 160 kb/s
Output #0, ogg, to 'sound.ogg':
Metadata:
encoder : Lavf53.4.0
Stream #0.0: Audio: libvorbis, 44100 Hz, stereo, s16, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Press [q] to stop, [?] for help
size= 62kB time=00:00:10.02 bitrate= 50.3kbits/s
video:0kB audio:57kB global headers:4kB muxing overhead 1.072614%

video.avi orignal size is 10.02 sec


After conversion ffmpeg -i sound.ogg gives that size is 4.91 sec:


ffmpeg -i alice10s.ogg
ffmpeg version 0.8, Copyright (c) 2000-2011 the FFmpeg developers
built on Jun 23 2011 14:21:12 with gcc 4.5.3
configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 9. 1 / 51. 9. 1
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 4. 0 / 53. 4. 0
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 23. 0 / 2. 23. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, ogg, from 'sound.ogg':
Duration: 00:00:04.91, start: 0.000000, bitrate: 102 kb/s
Stream #0.0: Audio: vorbis, 44100 Hz, stereo, s16, 64 kb/s
Metadata:
ENCODER : Lavf53.4.0
At least one output file must be specified

NB! The file it self sound.ogg lasts 10 seconds if played in player, nothing is trimmed.


The options -q and -map are not supported on my ffmpeg version which is 0.8


UPD: It seems that there is a OGG problems in pre 1.x version. I wonder if its possible to work them around.



Answer



Well, based on the comments, ogg support is broken in your old ffmpeg build.


You need to work around somehow; with a separate ogg encoder, or something.


As an aside, if you haven't, you should ask your hosting provider to install a newer ffmpeg. clearly this one is borked.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...