[FFmpeg-devel] need fix: correct muxing to VOB with LPCM audio
Michael Niedermayer
michaelni at gmx.at
Wed Mar 14 20:24:10 CET 2012
On Wed, Mar 14, 2012 at 05:54:21PM +0400, Pavel Sokolov wrote:
>
>
> 12.03.2012 16:25, Pavel Sokolov пишет:
> >Hi All!
> >
> >I got errors when I try to remux any file to VOB with LPCM by the
> >following command:
> >ffmpeg -i video-mpeg4_720x544-audio_ac3_48000_stereo.avi -vcodec
> >copy -acodec pcm_s16be -f vob out.vob
> >---------
> >vob @ 0x1745b80] buffer underflow i=1 bufi=4026 size=6144
> >Last message repeated 34 times
> >[vob @ 0x1745b80] packet too large, ignoring buffer limits to mux it
> >[vob @ 0x1745b80] buffer underflow i=1 bufi=4026 size=6144
> >[vob @ 0x1745b80] buffer underflow i=1 bufi=6043 size=6144
> >...
> >...
> >---------
> >VLC does not play the resulting file.
> >
> >
> >Sample:
> >http://sokolov.me/tmp/video-mpeg4_720x544-audio_ac3_48000_stereo.avi
> >
> >Examples with correct LPCM: (VLC play it without any problems)
> >http://streams.videolan.org/samples/MPEG-VOB/LPCM/Fever.vob
> >http://streams.videolan.org/samples/MPEG-VOB/LPCM/Kylie%20Minogue%20%5bGreatest%20Hits%20%2787-%2797%2021%5d%20-%20Confide%20In%20Me%20(5m56s%20VOB%20720x480%20LPCM).vob
> >
> >
> >Can somebody fix this issue? I will pay for this work.
> >
> After this patch VLC plays audio, but there is no video
> http://patches.libav.org/patch/18699/
This patch is not sufficient, the generated MPEG-PS is still invalid
LPCM packets cant be arbitrary large and even if they could be,
the MPEG-PS muxer cant handle that.
The patch below may make the file closer to being valid (this of
course can be implemented in many different ways and below is maybe
not the best, its more to show where the issue is)
The reason why i cant just say for sure if this is enough or not or
what is still needed is because the DVD specs arent public and
arent cheap.
diff --git a/ffmpeg.c b/ffmpeg.c
index 36e3098..5600f6b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1291,7 +1291,7 @@ need_realloc:
av_assert0(ost->audio_resample || dec->sample_fmt==enc->sample_fmt);
/* now encode as many frames as possible */
- if (!(enc->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) {
+ if (!(enc->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) || enc->frame_size>1) {
/* output resampled raw samples */
if (av_fifo_realloc2(ost->fifo, av_fifo_size(ost->fifo) + size_out) < 0) {
av_log(NULL, AV_LOG_FATAL, "av_fifo_realloc2() failed\n"); header_len -= skip;
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 098e076..5008dd1 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -359,6 +359,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
stream->lpcm_header[1] = (st->codec->channels - 1) | (j << 4);
stream->lpcm_header[2] = 0x80;
stream->lpcm_align = st->codec->channels * 2;
+ st->codec->frame_size = 150;
} else {
stream->id = mpa_id++;
}
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120314/f453a3c0/attachment.asc>
More information about the ffmpeg-devel
mailing list