Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#1814 closed defect (fixed)

lavf identifies wrong video stream

Reported by: i.am@… Owned by: reimar
Priority: normal Component: vf
Version: unspecified Severity: major
Keywords: Cc: cehoyos, poltsy@…, ekisoft.general@…, kxenator@…
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

MPlayer SVN-r32531-4.4.4

Hello,

I am having issues with mplayer's identify which is used by SMPlayer to determine video stream id.

MPlayer SVN-r32531-4.4.4 (C) 2000-2010 MPlayer Team

Playing nikita.s01e06.720p.hdtv.x264-ctu.mkv.
libavformat file format detected.
[matroska,webm @ 0x349e5e0] Estimating duration from bitrate, this may be inaccurate
ID_AUDIO_ID=0
[lavf] stream 0: audio (ac3), -aid 0
ID_VIDEO_ID=0
[lavf] stream 1: video (h264), -vid 0
VIDEO: [H264] 1280x720 0bpp 24.000 fps 0.0 kbps ( 0.0 kbyte/s)

As you can see from here, even when video stream should be "1", mplayer passes -vid 0 for SMPlayer, which causes it to play movie without image.

Please follow up on http://smplayer.berlios.de/forum/viewtopic.php?f=2&t=375, where this issue and work-around is figured. However work-around(using matroska demuxer) isn't for me, as I watch movies with PGS subtitles, and they only work with lavf.

Work around:

$(HOME)/.mplayer/config:

[extension.mkv]
demuxer=mkv

But shouldn't be used because there's superior lavf already out.

Greetings,
Sam

Change History (16)

comment:1 by reimar, 14 years ago

If someone actually provided a sample file there might be a chance this gets fixed soon.
If you expect us to search around wildly in the code hoping to find the bug by pure chance you might have to wait a long time though.

comment:2 by reimar, 14 years ago

And as a first step you can test this hack:
Index: libmpdemux/demuxer.c
===================================================================
--- libmpdemux/demuxer.c (revision 32533)
+++ libmpdemux/demuxer.c (working copy)
@@ -229,8 +229,7 @@

demuxer_t *new_demuxer(stream_t *stream, int type, int a_id, int v_id,

int s_id, char *filename)

{

  • demuxer_t *d = malloc(sizeof(demuxer_t));
  • memset(d, 0, sizeof(demuxer_t));

+ demuxer_t *d = calloc(1, sizeof(*d));

d->stream = stream;
d->stream_pts = MP_NOPTS_VALUE;
d->reference_clock = MP_NOPTS_VALUE;

@@ -339,6 +338,10 @@

mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", aid, lang);

}

}

+ if (aid == audio_id) {
+ demuxer->audio->id = id;
+ demuxer->audio->sh = demuxer->a_streams[id];
+ }

return demuxer->a_streams[id];

}


@@ -374,6 +377,10 @@

sh->ds = demuxer->video;
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ID=%d\n", vid);

}

+ if (vid == video_id) {
+ demuxer->video->id = id;
+ demuxer->video->sh = demuxer->v_streams[id];
+ }

return demuxer->v_streams[id];

}

comment:3 by i.am@…, 14 years ago

(In reply to comment #1)

If someone actually provided a sample file there might be a chance this gets
fixed soon.
If you expect us to search around wildly in the code hoping to find the bug by
pure chance you might have to wait a long time though.

Sorry, you have any tips how I could create couple seconds sample for you, to keep MKV file. mencoder changed it to aviheaders.

Thank you for your time!

comment:4 by i.am@…, 14 years ago

(In reply to comment #2)

And as a first step you can test this hack:
Index: libmpdemux/demuxer.c
===================================================================
--- libmpdemux/demuxer.c (revision 32533)
+++ libmpdemux/demuxer.c (working copy)
@@ -229,8 +229,7 @@

demuxer_t *new_demuxer(stream_t *stream, int type, int a_id, int v_id,

int s_id, char *filename)

{

  • demuxer_t *d = malloc(sizeof(demuxer_t));
  • memset(d, 0, sizeof(demuxer_t));

+ demuxer_t *d = calloc(1, sizeof(*d));

d->stream = stream;
d->stream_pts = MP_NOPTS_VALUE;
d->reference_clock = MP_NOPTS_VALUE;

@@ -339,6 +338,10 @@

mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", aid,

lang);

}

}

+ if (aid == audio_id) {
+ demuxer->audio->id = id;
+ demuxer->audio->sh = demuxer->a_streams[id];
+ }

return demuxer->a_streams[id];

}

@@ -374,6 +377,10 @@

sh->ds = demuxer->video;
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ID=%d\n", vid);

}

+ if (vid == video_id) {
+ demuxer->video->id = id;
+ demuxer->video->sh = demuxer->v_streams[id];
+ }

return demuxer->v_streams[id];

}

this is a .diff file?

comment:5 by i.am@…, 14 years ago

(In reply to comment #2)

And as a first step you can test this hack:
Index: libmpdemux/demuxer.c
===================================================================
--- libmpdemux/demuxer.c (revision 32533)
+++ libmpdemux/demuxer.c (working copy)
@@ -229,8 +229,7 @@

demuxer_t *new_demuxer(stream_t *stream, int type, int a_id, int v_id,

int s_id, char *filename)

{

  • demuxer_t *d = malloc(sizeof(demuxer_t));
  • memset(d, 0, sizeof(demuxer_t));

+ demuxer_t *d = calloc(1, sizeof(*d));

d->stream = stream;
d->stream_pts = MP_NOPTS_VALUE;
d->reference_clock = MP_NOPTS_VALUE;

@@ -339,6 +338,10 @@

mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", aid,

lang);

}

}

+ if (aid == audio_id) {
+ demuxer->audio->id = id;
+ demuxer->audio->sh = demuxer->a_streams[id];
+ }

return demuxer->a_streams[id];

}

@@ -374,6 +377,10 @@

sh->ds = demuxer->video;
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ID=%d\n", vid);

}

+ if (vid == video_id) {
+ demuxer->video->id = id;
+ demuxer->video->sh = demuxer->v_streams[id];
+ }

return demuxer->v_streams[id];

}

This did it for me, all files now plays with lavf demuxer. You might want to apply this patch to SVN.

Applied patch with 'patch -p0 < comment2.patch' and recompiled mplayer from sources.

Thanks!

comment:6 by i.am@…, 14 years ago

(In reply to comment #1)

If someone actually provided a sample file there might be a chance this gets
fixed soon.
If you expect us to search around wildly in the code hoping to find the bug by
pure chance you might have to wait a long time though.

Sorry for spamming.

I have right now uploaded sample file to ftp://upload.mplayerhq.hu/MPlayer/incoming named lavf-sample.mkv. This should help you to reproduce problem with -identify.

Thanks

comment:7 by poltsy@…, 14 years ago

Cc: poltsy@… added

comment:8 by reimar, 14 years ago

Cc: ekisoft.general@… added

comment:9 by reimar, 14 years ago

Resolution: fixed
Status: newclosed

The patch was actually applied, however there's some cleanup to be done still I think.

comment:10 by cehoyos, 14 years ago

Cc: cehoyos@… added

Sample moved to /samples/mplayer-bugs/bug1814

comment:11 by i.am@…, 14 years ago

Resolution: fixed
Status: closedreopened

Still having same problem with newest svn mplayer.

[Sam@fedora14 South.Park.S14E14.720p.HDTV.x264-CTU]$ mplayer -identify south.park.s14e14.720p.hdtv.x264-ctu.mkv
MPlayer SVN-r32636-4.5.1 (C) 2000-2010 MPlayer Team

Playing south.park.s14e14.720p.hdtv.x264-ctu.mkv.
libavformat file format detected.
[matroska,webm @ 0x17879a0] Estimating duration from bitrate, this may be inaccurate
ID_AUDIO_ID=0
[lavf] stream 0: audio (ac3), -aid 0
ID_VIDEO_ID=0
[lavf] stream 1: video (h264), -vid 0
VIDEO: [H264] 1280x720 0bpp 24.000 fps 0.0 kbps ( 0.0 kbyte/s)
ID_FILENAME=south.park.s14e14.720p.hdtv.x264-ctu.mkv
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=H264
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=1280
ID_VIDEO_HEIGHT=720
ID_VIDEO_FPS=24.000
ID_VIDEO_ASPECT=1.7778
ID_AUDIO_FORMAT=8192
ID_AUDIO_BITRATE=384000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_START_TIME=0.00
ID_LENGTH=1306.02
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 384.0 kbit/25.00% (ratio: 48000->192000)
ID_AUDIO_BITRATE=384000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=ffac3
Starting playback...

Notice part ID_VIDEO_ID=0
[lavf] stream 1: video (h264), -vid 0

You should have sample in location which Carl specified.

comment:12 by reimar, 14 years ago

Resolution: fixed
Status: reopenedclosed

Sample still plays fine with -vid 0, I do not see any problem here.

comment:13 by i.am@…, 14 years ago

Resolution: fixed
Status: closedreopened

(In reply to comment #12)

Sample still plays fine with -vid 0, I do not see any problem here.

Strange.

/usr/bin/mplayer -noquiet -nofs -nomouseinput -vc ffh264vdpau,ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau -sub-fuzziness 2 -vo vdpau -ao pulse -stop-xscreensaver -vid 0 -channels 2 -softvol -softvol-max 350 south.park.s14e14.mkv
MPlayer SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing south.park.s14e14.mkv.
libavformat file format detected.
[matroska @ 0x1d07690] Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: audio (ac3), -aid 0
[lavf] stream 1: video (h264), -vid 0
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 384.0 kbit/25.00% (ratio: 48000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...

Notice here that I used -vid 0 which MPlayer passed to me. No video.

Let's try with -vid 1:

/usr/bin/mplayer -noquiet -nofs -nomouseinput -vc ffh264vdpau,ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau -sub-fuzziness 2 -vo vdpau -ao pulse -stop-xscreensaver -vid 1 -channels 2 -softvol -softvol-max 350 south.park.s14e14.mkv
MPlayer SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing south.park.s14e14.mkv.
libavformat file format detected.
[matroska @ 0x3482690] Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: audio (ac3), -aid 0
[lavf] stream 1: video (h264), -vid 0
VIDEO: [H264] 1280x720 0bpp 24.000 fps 0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Forced video codec: ffh264vdpau
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264vdpau] vfm: ffmpeg (FFmpeg H.264 (VDPAU))
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 384.0 kbit/25.00% (ratio: 48000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
[VD_FFMPEG] Trying pixfmt=0.
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1280x720 => 1280x720 H.264 VDPAU acceleration
[VD_FFMPEG] XVMC-accelerated MPEG-2.
A: 4.6 V: 4.6 A-V: -0.003 ct: 0.003 0/ 0 8% 2% 0.4% 4 0

Guess I had bad demonstrate, but there's some problem as you can see. I'm confident that the sample I provided earlier would cause same result, but if it doesn't, I'll provide you new sample, after good night sleep.

comment:14 by i.am@…, 14 years ago

(In reply to comment #13)

(In reply to comment #12)

Sample still plays fine with -vid 0, I do not see any problem here.

Strange.

/usr/bin/mplayer -noquiet -nofs -nomouseinput -vc
ffh264vdpau,ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau -sub-fuzziness 2 -vo vdpau -ao
pulse -stop-xscreensaver -vid 0 -channels 2 -softvol -softvol-max 350
south.park.s14e14.mkv
MPlayer SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing south.park.s14e14.mkv.
libavformat file format detected.
[matroska @ 0x1d07690] Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: audio (ac3), -aid 0
[lavf] stream 1: video (h264), -vid 0
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 384.0 kbit/25.00% (ratio: 48000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...

Notice here that I used -vid 0 which MPlayer passed to me. No video.

Let's try with -vid 1:

/usr/bin/mplayer -noquiet -nofs -nomouseinput -vc
ffh264vdpau,ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau -sub-fuzziness 2 -vo vdpau -ao
pulse -stop-xscreensaver -vid 1 -channels 2 -softvol -softvol-max 350
south.park.s14e14.mkv
MPlayer SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing south.park.s14e14.mkv.
libavformat file format detected.
[matroska @ 0x3482690] Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: audio (ac3), -aid 0
[lavf] stream 1: video (h264), -vid 0
VIDEO: [H264] 1280x720 0bpp 24.000 fps 0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Forced video codec: ffh264vdpau
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264vdpau] vfm: ffmpeg (FFmpeg H.264 (VDPAU))
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 384.0 kbit/25.00% (ratio: 48000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
[VD_FFMPEG] Trying pixfmt=0.
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1280x720 => 1280x720 H.264 VDPAU acceleration
[VD_FFMPEG] XVMC-accelerated MPEG-2.
A: 4.6 V: 4.6 A-V: -0.003 ct: 0.003 0/ 0 8% 2% 0.4% 4 0

Guess I had bad demonstrate, but there's some problem as you can see. I'm
confident that the sample I provided earlier would cause same result, but if it
doesn't, I'll provide you new sample, after good night sleep.

GAH!

Should sleep more. I was using old version with those, silly me. Sorry for this, its resolved. (new svn version was on /usr/local/bin/mplayer)

comment:15 by i.am@…, 14 years ago

Resolution: fixed
Status: reopenedclosed

Changing to resolved

comment:16 by kxenator@…, 14 years ago

Cc: kxenator@… added

Hi I applied your patch and it works with -vid 0, but unfortunately now it doesn't work with -aid 0. After a second there is no sound and there is many error messages of the following format:
Too many video packets in the buffer: (2058 in 33556814 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
A: 1.0 V: 3.9 A-V: -2.897 ct: -9.460 0/ 0 15% 21% 2.2% 6 0

Note: See TracTickets for help on using tickets.