Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#9892 closed Bug Report - Hang/Deadlock (fixed)

Latest mplayer breaks nuvexport

Reported by: cto@… Owned by: beirdo
Priority: minor Milestone: 0.25
Component: Bindings - Perl Version: 0.24.1
Severity: medium Keywords: nuvexport, mplayer, mencoder
Cc: Ticket locked: no

Description

The lastest version of mplayer breaks nuvexport. After selecting a show you want to export, nuvexport calls mplayer to get information on the video. This mplayer call results in mplayer going crazy indefinitely. That call is:

/usr/bin/mplayer -v -v -v -v -nolirc - nojoystick -vo null -ao null -frames 1 -identify '/path/to/some/random/mythtv/recording' 2> /dev/null

The problems is the -frames 1 bit. When manually using with -frames 0 it appears to give desired output. Oddly, when grep'ing my nuvexport code, I couldn't find "-frames 1" *ANYWHERE*. I did see, however, "-frames 0" in what looks like it should generate the aformentioned mplayer call in nuvinfo.pm .... this begs the question, just where in the hell is -frames 1 coming from anyway??

Using Arch Linux.... but this has reared its ugly head in Fedora as well: http://lists.atrpms.net/pipermail/atrpms-users/2011-June/012721.html

Change History (5)

comment:1 Changed 13 years ago by Raymond Wagner

Component: Apps - NuvexportBindings - Perl
Owner: changed from xris to beirdo
Status: newassigned
Type: Bug Report - GeneralBug Report - Hang/Deadlock

The error is actually in a very similar call in the Perl bindings. The Perl bindings are calling mplayer to gather a bunch of information about the video in question. The final plan for this is to make the information available in the database, populated at the time of recording, however this is likely not to happen until 0.26. As a short term alternative, MythTV now builds a 'mythffmpeg', intended as a target static to a specific MythTV release (rather than the moving target that is ffmpeg), that could be used to extract this information.

comment:2 Changed 13 years ago by Github

Milestone: unknown0.25
Resolution: fixed
Status: assignedclosed

Change -frames 1 to -frames 0 in the perl bindings

With the version of mplayer I have, it makes no difference, but apparently in newer mplayer versions, it can make a difference somehow. Beats me why mplayer would have an issue with decoding one single video frame, but whatever.

Fixes #9892

Branch: master Changeset: d852c8f6d80061d17ee3fa0e5adbc8029fbe16c0

comment:3 Changed 13 years ago by mpc_myth@…

The problem with switching to -frames 0 instead of -frames 1 is that it causes mis-detections of the aspect ratio for some recordings.

Example recording from BBC1 (TV, 10th Sep 11) produces a non-detection of the aspect ratio:

$ mplayer -frames 0 -identify 1001_20110910180000.mpg 2>&1 | grep ^ID
ID_VIDEO_ID=0
ID_AUDIO_ID=0
ID_FILENAME=1001_20110910180000.mpg
ID_DEMUXER=mpegps
ID_VIDEO_FORMAT=0x10000002
ID_VIDEO_BITRATE=15000000
ID_VIDEO_WIDTH=720
ID_VIDEO_HEIGHT=576
ID_VIDEO_FPS=25.000
ID_VIDEO_ASPECT=0.0000     <<<< Badly detected aspect ratio
ID_AUDIO_FORMAT=80
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=0
ID_AUDIO_NCH=0
ID_START_TIME=0.29
ID_LENGTH=3841.48
ID_SEEKABLE=1
ID_CHAPTERS=0
ID_VIDEO_CODEC=ffmpeg2
ID_AUDIO_BITRATE=256000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_AUDIO_CODEC=mpg123
ID_EXIT=EOF

Running the same with -frames 1 gives:

$ mplayer -frames 1 -identify 1001_20110910180000.mpg 2>&1 | grep ^ID
ID_VIDEO_ID=0
ID_AUDIO_ID=0
ID_FILENAME=1001_20110910180000.mpg
ID_DEMUXER=mpegps
ID_VIDEO_FORMAT=0x10000002
ID_VIDEO_BITRATE=15000000
ID_VIDEO_WIDTH=720
ID_VIDEO_HEIGHT=576
ID_VIDEO_FPS=25.000
ID_VIDEO_ASPECT=0.0000     <<<< As before
ID_AUDIO_FORMAT=80
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=0
ID_AUDIO_NCH=0
ID_START_TIME=0.29
ID_LENGTH=3841.48
ID_SEEKABLE=1
ID_CHAPTERS=0
ID_VIDEO_CODEC=ffmpeg2
ID_AUDIO_BITRATE=256000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_AUDIO_CODEC=mpg123
ID_VIDEO_ASPECT=1.7778     <<<<< Correct ratio
ID_EXIT=EOF

So, although the change to -frames 0 avoids the 'forever-hang' on some recordings, it causes others to have the wrong aspect ratio reported.

Cheers,

Mark

comment:4 Changed 13 years ago by mpc_mythtv@…

I should have said - differences between recordings from the same channel that work and that don't work appear to be down to mplayer detecting the broadcast stream as MPEG-PS or as TS.

A recording that works with -frames 1:

# mplayer -frames 1 -vo null -identify 1001_20110910180000.mpg 2>&1
MPlayer UNKNOWN-4.1.2 (C) 2000-2011 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick

Playing 1001_20110910180000.mpg.
ID_VIDEO_ID=0
ID_AUDIO_ID=0
MPEG-PS file format detected.
VIDEO:  MPEG2  720x576  (aspect 3)  25.000 fps  15000.0 kbps (1875.0 kbyte/s)
Load subtitles in ./
ID_FILENAME=1001_20110910180000.mpg
ID_DEMUXER=mpegps
ID_VIDEO_FORMAT=0x10000002
ID_VIDEO_BITRATE=15000000
ID_VIDEO_WIDTH=720
ID_VIDEO_HEIGHT=576
ID_VIDEO_FPS=25.000
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_FORMAT=80
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=0
ID_AUDIO_NCH=0
ID_START_TIME=0.29
ID_LENGTH=3841.48
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
==========================================================================
ID_VIDEO_CODEC=ffmpeg2
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
ID_AUDIO_BITRATE=256000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [oss] 48000Hz 2ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=mpg123
Starting playback...
[VD_FFMPEG] Trying pixfmt=0.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Opening video filter: [lavc]
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
[VD_FFMPEG] Trying pixfmt=1.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Opening video filter: [lavc]
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
[VD_FFMPEG] Trying pixfmt=2.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Opening video filter: [lavc]
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
ID_VIDEO_ASPECT=1.7778
VO: [null] 720x576 => 1024x576 Planar YV12 
A:   0.3 V:   0.3 A-V:  0.038 ct:  0.000   2/  2 ??% ??% ??,?% 0 0 


Exiting... (End of file)
ID_EXIT=EOF

A recording that does not:

$ mplayer -frames 1 -identify /mnt/d5/tv/1007_20110904185500.mpg
MPlayer UNKNOWN-4.1.2 (C) 2000-2011 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick

Playing /mnt/d5/tv/1007_20110904185500.mpg.
TS file format detected.
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)

<snip a lot of repeats of the previous line>

NO VIDEO! AUDIO MPA(pid=621) NO SUBS (yet)!  PROGRAM N. 1
ID_AUDIO_ID=621
ID_AID_621_LANG=eng
Load subtitles in /mnt/d5/tv/
ID_FILENAME=/mnt/d5/tv/1007_20110904185500.mpg
ID_DEMUXER=mpegts
ID_AUDIO_FORMAT=80
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=0
ID_AUDIO_NCH=0
ID_VIDEO_ID=620
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
ID_START_TIME=31746.15
ID_LENGTH=0.00
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
ID_AUDIO_BITRATE=256000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [oss] 48000Hz 2ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=mpg123
Video: no video
Starting playback...

< with -frames 0, mplayer quits here. ( Exiting... (End of file) and ID_EXIT=EOF >

PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31746.2 ( 8:49:06.1) of 72539.6 (20:08:59.6) ??,?% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31746.3 ( 8:49:06.3) of 72539.6 (20:08:59.6) ??,?% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31746.4 ( 8:49:06.3) of 72539.6 (20:08:59.6)  0.2% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31746.5 ( 8:49:06.5) of 72539.6 (20:08:59.6)  0.2% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31746.6 ( 8:49:06.6) of 72539.6 (20:08:59.6)  0.2% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31746.8 ( 8:49:06.7) of 72539.6 (20:08:59.6)  0.2% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31746.9 ( 8:49:06.9) of 72539.6 (20:08:59.6)  0.2% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31747.0 ( 8:49:06.9) of 72539.6 (20:08:59.6)  0.2% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31747.1 ( 8:49:07.1) of 72539.6 (20:08:59.6)  0.2% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31747.3 ( 8:49:07.2) of 72539.6 (20:08:59.6)  0.2% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
ID_SUBTITLE_ID=623
ID_SID_623_LANG=eng
A:31747.4 ( 8:49:07.3) of 72539.6 (20:08:59.6)  0.3% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31747.5 ( 8:49:07.4) of 72539.6 (20:08:59.6)  0.3% 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31747.6 ( 8:49:07.5) of 72539.6 (20:08:59.6)  0.3% 
<snip>

Hope that helps a little more. It looks like a flaw in mplayer rather than a bug in nuvexport/myth's perl libraries.

Cheers,

Mark

 Setup: Centos 5.6, 64bit, atrpms

 mythtv-backend-0.24.1-277.el5.x86_64
 mplayer-1.0-87_snap20110830.el5.x86_64  ( have tried back to 0.79 - same behaviour )
 nuvexport-0.5-6_20110102.svn.el5.noarch

comment:5 Changed 13 years ago by mpc_mythtv@…

Hi all,

I found another workaround - it looks like increasing the amount of the stream that mplayer looks at can also fix the problem of non-detected video.

Swapping the command line for:

$ mplayer -frames 1 -tsprobe 100000000 -identify /mnt/d5/tv/1007_20110904185500.mpg
MPlayer UNKNOWN-4.1.2 (C) 2000-2011 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick

Playing /mnt/d5/tv/1007_20110904185500.mpg.
TS file format detected.
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)

<snip a lot of repeats>

VIDEO MPEG2(pid=620) AUDIO MPA(pid=621) SUB DVB(pid=623)  PROGRAM N. 1
ID_VIDEO_ID=620
ID_AUDIO_ID=621
ID_AID_621_LANG=eng
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
VIDEO:  MPEG2  720x576  (aspect 3)  25.000 fps  15000.0 kbps (1875.0 kbyte/s)
Load subtitles in /mnt/d5/tv/
ID_FILENAME=/mnt/d5/tv/1007_20110904185500.mpg
ID_DEMUXER=mpegts
ID_VIDEO_FORMAT=0x10000002
ID_VIDEO_BITRATE=15000000
ID_VIDEO_WIDTH=720
ID_VIDEO_HEIGHT=576
ID_VIDEO_FPS=25.000
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_FORMAT=80
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=0
ID_AUDIO_NCH=0
ID_START_TIME=31746.15
ID_LENGTH=1238.01
ID_SEEKABLE=1
ID_CHAPTERS=0
Xlib:  extension "XFree86-VidModeExtension" missing on display "localhost:11.0".
Xlib:  extension "NV-GLX" missing on display "localhost:11.0".
[vdpau] Error when calling vdp_device_create_x11: 1
[VO_XV] It seems there is no Xvideo support for your video card available.
[VO_XV] Run 'xvinfo' to verify its Xv support and read
[VO_XV] DOCS/HTML/en/video.html#xv!
[VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.
[VO_XV] Try -vo x11.
[gl] using extended formats. Use -vo gl:nomanyfmts if playback fails.
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
==========================================================================
ID_VIDEO_CODEC=ffmpeg2
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
ID_AUDIO_BITRATE=256000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [oss] 48000Hz 2ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=mpg123
Starting playback...
[VD_FFMPEG] Trying pixfmt=0.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
[VD_FFMPEG] Trying pixfmt=1.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
[VD_FFMPEG] Trying pixfmt=2.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
ID_VIDEO_ASPECT=1.7778
VO: [gl_nosw] 720x576 => 1024x576 Planar YV12 
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
PROGRAM_ID=1 (0x01), PMT_PID: 4351(0x10FF)
A:31746.5 V:31747.9 A-V: -1.404 ct:  0.000   4/  4 ??% ??% ??,?% 3 0 


Exiting... (End of file)
ID_EXIT=EOF

I've checked, and it seems that adding -tsprobe <big number> doesn't hurt mplayer's identification of MPEG-PS, so this might be able to be added routinely. I've added it to Recording.pm, and it does fix the hang for me.

50,000,000 seems to reliably hang, 60,000,000 seems to work for some recordings, 120,000,000 seems to work reliably for me for a collection of about 100 tv recordings.

Nothing seems to prevent the hang for radio recordings without a video stream. Piping in a 'q' after 15 seconds should cause mplayer to quit gracefully but feels somewhat ugly.

Cheers,

Mark

( Sorry for the repeated additions to this ticket. )

Note: See TracTickets for help on using tickets.