I was just debugging mplayer.sh because I could not get it to play a .vdr file with an audio track set to "0", then I realized that if the AID is set to 0, the mplayer plugin does not actually specify 0 for the AID track (it just leaves it blank). The following changes to mplayer.sh fix the problem.
while shift; do if [ "$1" = "SLAVE" ]; then declare SLAVE="$1" elif [ "$1" = "AID" ]; then declare AID="-aid $2" shift fi if [ "$AID" = "" ]; then declare AID="-aid 0" fi done
Regards, C.
C.Y.M wrote:
Here is a patch for mplayer.sh-0.8.6 which fixes the AID problem for "-aid 0" and also automatically increments the AID by 1 when an AVI is detected. There was also a video resolution missing from the NTSC "direct video" detection.
Regards, C.
--- plugins/mplayer.sh.orig 2004-11-06 13:00:00.000000000 -0800 +++ plugins/mplayer.sh 2005-06-26 10:16:27.000000000 -0700 @@ -481,7 +481,17 @@ declare ORIG_FPS NEW_FPS ORIG_ASPECT VIDEO_FORMAT AUDIO_CODEC declare CMDLINE AOUT REMOTE USERDEF SUFFIX declare FILE="$1" -declare SLAVE="$2" +while shift; do + if [ "$1" = "SLAVE" ]; then + declare SLAVE="$1" + elif [ "$1" = "AID" ]; then + declare AID="$2" + shift + fi + if [ "$AID" = "" ]; then + declare AID="0" + fi +done declare -a XResPAL[0] declare -a XResNTSC[0] declare FDSTR="" @@ -540,15 +550,20 @@ choosebesty if test $NEW_X -eq 0 -o $NEW_Y -eq 0; then echolog "*** FATAL: Illegal Resolution ..."; exit; fi
+ if test $VIDEO_FORMAT == "DIV3"; then + echolog "*** INFO: AVI detected. Increasing AID by 1" + AID=$(($AID+1)) + fi + if test $MPEG_DIRECT == "true" -a ( $VIDEO_FORMAT == "0x10000001" -o $VIDEO_FORMAT == "0x10000002" ) -a ( \ ( $PAL -a $NEW_FPS == "25" -a ( ( $ORIG_X == "352" -a $ORIG_Y == "288" ) -o ( $ORIG_Y == "576" -a \ ( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "528" -o $ORIG_X == "544" -o $ORIG_X == "688" -o $ORIG_X == "704" -o $ORIG_X == "720" ) ) ) ) -o \ ( $NTSC -a $NEW_FPS == "30" -a ( ( $ORIG_X == "352" -a $ORIG_Y == "240" ) -o ( $ORIG_Y == "480" -a \ - ( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "512" -o $ORIG_X == "640" -o $ORIG_X == "704" -o $ORIG_X == "720" ) ) ) ) \ + ( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "512" -o $ORIG_X == "544" -o $ORIG_X == "640" -o $ORIG_X == "704" -o $ORIG_X == "720" ) ) ) ) \ ) ; then - CMDLINE="$MPLAYER -vo $VO $AOUT $FDSTR $CACHESTR $REMOTE $USERDEF" + CMDLINE="$MPLAYER -vo $VO $AOUT -aid $AID $FDSTR $CACHESTR $REMOTE $USERDEF" else - CMDLINE="$MPLAYER -vo $VO $AOUT -vop $VOP:$NEW_FPS,expand=$NEW_X:$REAL_Y:-1:-1:1,scale=$NEW_X:${NEW_Y}${DETC} $SPEED $FDSTR $CACHESTR $REMOTE $SUBTITLES $USERDEF $FORCEIDX" + CMDLINE="$MPLAYER -vo $VO $AOUT -aid $AID -vop $VOP:$NEW_FPS,expand=$NEW_X:$REAL_Y:-1:-1:1,scale=$NEW_X:${NEW_Y}${DETC} $SPEED $FDSTR $CACHESTR $REMOTE $SUBTITLES $USERDEF $FORCEIDX" fi fi
"C.Y.M" syphir@syphir.sytes.net wrote:
[snip]
Yeah, I haven't implemented this yet and I might not do this in the future as mplayer now seems to be able to switch audio on the fly - this just needs to be supported by the mplayer-plugin (hint, hint!).
This AID stuff has more problems of that kind that you encountered, too: If you have a VOB file with AC3 sound the audio ids are again different and if the VOB file has PCM audio you need a different aid again...
was also a video resolution missing from the NTSC "direct video" detection.
Sorry, I know you send me a patch for this some time ago and it is in my developement branch but I didn't update the "stable" branch.
I hope to get a new version out end of July.
Cheers, Juri
Juri Haberland wrote:
I think the main problem with the AID 0 is this line:
player-mplayer.c: if(MPlayerAid>0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid);
So, if the AID is not > 0, it does not specify the ID.
It should be:
player-mplayer.c: if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid);
Regards, C.
"C.Y.M" syphir@syphir.sytes.net wrote:
Juri Haberland wrote:
Oh, I misread that part of your initial mail. I thought the problem is in mplayer.sh where I didn't implemented the AID logic.
Cheers, Juri
On 29 Jun 2005 Juri Haberland list-linux.vdr@koschikode.com wrote:
What is the "slave" command to switch the AID? Is there a slave command to list all available AID's? Is there a way to detect on-the-fly if the running mplayer supports AID changes?
Regards.
On 30 Jun 2005 "C.Y.M" syphir@syphir.sytes.net wrote:
In this case, you can obmit the check completely. The value never can be <0.
The idea is, to have a "default mode" where mplayer selects the right AID. AID=0 was used to flag default mode, which now seems to be a bad definition.
Further problem is, that you cannot enter a value <0 in VDR's cEditIntItem. I'm investigating a solution.
Regards.
Stefan Huelswitt s.huelswitt@gmx.de wrote:
switch_audio
Is there a slave command to list all available AID's?
no, switch_audio just cycles through all available audio tracks
Is there a way to detect on-the-fly if the running mplayer supports AID changes?
Not that I know of, but older versions seem to ignore switch_audio.
The only way to determin the slave commands understood is to call mplayer with '-input cmdlist'.
Cheers, Juri
PS: yes, I'll support the aid stuff in the next release, though I'm not happy with it.
On 30 Jun 2005 Juri Haberland list-linux.vdr@koschikode.com wrote:
What is the prevered key (on VDR's remote) to bind the switch_audio?
Regards.
Stefan Huelswitt s.huelswitt@gmx.de wrote:
Uhm, I just saw that in the meantime all keys with digits are used - and the colored keys as well - I don't have a good idea. Just pick one that is on most RCs.
Cheers, Juri
On 30 Jun 2005 Juri Haberland list-linux.vdr@koschikode.com wrote:
Hmm, may be I should remove the dvdnav stuff. I got reports that it doesn't works and that it has been removed completely from current mplayer version. This would free up some keys.
Regards.
Stefan Huelswitt s.huelswitt@gmx.de wrote:
Yes, I think this is a good idea - I never unterstood folks that wanted to use mplayer to watch DVDs - it's just not in the shape to do the most basic task.
Though I included a patch in mplayer.sh to play DVDs I later on declared it unsupported und suggested people should spend their time in fixing and improving the DVD-plugin.
Cheers, Juri
Hi,
attached is a patch which:
1.) fix the AID 0 problem. AID 0 is now allways passed. The default autoselect is now on AID -1. To enter the -1 value, first press 0 and than left.
2.) supports switch_audio slave command. The command is mapped to key 2.
Regards.
PS: line numbers may be a bit off
"C.Y.M" syphir@syphir.sytes.net wrote:
Thanks! So, after applying this to the mplayer plugin, what should be changed in mplayer.sh?
At best - nothing. Just use a recent (>= 1.0pre7) version of mplayer and cycle through the available audio tracks with button number '2'.
Cheers, Juri
On 02 Jul 2005 Juri Haberland list-linux.vdr@koschikode.com wrote:
I'm not sure about, but any feedback welcome.
Regards.
Stefan Huelswitt wrote:
Ok, This is what I have seen so far (while using this new patch for the mplayer plugin).
If I set the AID to "default", and do not make any changes to mplayer.sh-0.8.6 (reversing my patch above), then I am able to switch AIDs on the fly using the "2" key on the remote. But, without any changes to mplayer.sh, I am not able to specify a particular default AID (ie; setting AID to 0,1,2,...). This would not be a problem, except that Mplayer seems to default to AID=1 when there are two audio pids (0 and 1). IMHO, Mplayer should default to 0 before 1, if they both exist (apid 1 is the secondary audio track, so it should default to apid 0 first).
After re-applying the changes to mplayer.sh with my original patch on this thread, and setting the default AID to 0, and then trying to play a file that only contains AID 1, I am not able to switch to AID 1 using button "2" on the remote. But, If I try to play a file with two apids (0 and 1), then I can still switch between the two audio IDs with these changes to mplayer.sh. If mplayer does not start with a valid apid, then it will not be able to switch between apids. Therefore, I still had to add some logic to mplayer.sh that detects AVI file types and sets the apid to 1 (no matter what the default is in the plugin). Also, it appears that the mplayer plugin is still not returning "AID 0" to the mplayer.sh script.
Best Regards, C.
On 02 Jul 2005 "C.Y.M" syphir@syphir.sytes.net wrote:
Your mplayer.sh at least has to have support for the AID parameter and (vanilla) mplayer.sh-0.8.6 doesn't have it (AFAIK).
Also, it appears that the mplayer plugin is still not returning "AID 0" to the mplayer.sh script.
Well, I checked this and found that unfortunaly one change is missing in the patch:
- if(MPlayerAid>0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid); + if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid);
(I'll attach the whole patch for completenes)
Regards.
Stefan Huelswitt wrote:
Thanks for the new patch. Unfortunately, this does not seem to change anything.
1) AID 0 not returned to mplayer.sh when specified as default. Note: APID > 0 returns properly. 2) Mplayer prefers to default to APID 1 over APID 0 (probably a mplayer problem, not a mplayer plugin problem). 3) Mplayer is unable to switch between apids on the fly if mplayer is started out on a non-existing apid.
In order to make use of the configurable default apid, changes will need to be made to mplayer.sh to understand what "$AID" is.
Regards, C.
C.Y.M wrote:
If we keep the default AID at 0, then something like this would always apply, wouldn't it (see below)? If there were more audio tracks, then they could be selected with the "2" button. When attempting to play an AVI without this change, Mplayer would first try to select AID 0 (because thats the default), and then we could not use the "2" button to select AID 1 (reference to bug #3 above).
--SNIP--
if test $VIDEO_FORMAT == "DIV3" -o $VIDEO_FORMAT == "XVID"; then echolog "*** INFO: AVI file format detected. Setting default AID to 1" AID=1 fi
--SNIP--
Regards, C.
On 02 Jul 2005 "C.Y.M" syphir@syphir.sytes.net wrote:
I cannot understand this. The code is:
if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid);
which clearly should work with AID==0.
In order to make use of the configurable default apid, changes will need to be made to mplayer.sh to understand what "$AID" is.
Of course. This was mentioned in the HISTORY at the time the AID feature was introduced (version 0.9.8).
Regards.
Stefan Huelswitt wrote:
If I take this code in mplayer.sh and comment out the following section that checks if AID is defined..
--SNIP--
declare FILE="$1" #declare SLAVE="$2" while shift; do if [ "$1" = "SLAVE" ]; then declare SLAVE="$1" elif [ "$1" = "AID" ]; then declare AID="$2" shift fi # if [ "$AID" = "" ]; then # declare AID="0" # fi done
echolog "*** INFO: Audio track equals $AID"
and put some debug in to print the value of $AID, the value still comes up blank when AID is set to 0 in the plugin.
Best Regards, C.
"C.Y.M" syphir@syphir.sytes.net wrote:
No, this is normal. See 'man mplayer': MPEG: 0-31 AVI/OGM: 1-99 ASF/RM: 0-127 VOB(AC3): 128-159 VOB(LPCM): 160-191 MPEG-TS: 17-8190
IMO the configurable AID stuff should be removed from the mplayer plugin as it is a work-around for the formerly not existing switch-audio-on-the-fly function. I've always been against this sort of hack and told everyone in the german speaking VDR-Portal that it's not a good idea to implement this, because, as you found out, you have to examine the video and use different AIDs for the default audio track - depending on whether it's a mpeg, a avi - with or without AC3 sound and so on. I'm not willing to do this crap.
Please, Stefan, remove this mess - it was a mistake to implement it in the first place...
Cheers, Juri
"C.Y.M" syphir@syphir.sytes.net wrote:
For what do you need the AID stuff anyway, now that audio switching works?
Cheers, Juri
On 02 Jul 2005 "C.Y.M" syphir@syphir.sytes.net wrote:
No problem. I guessed something like that, but I wanted to test this in deep before blaming somebody. ;)
Regards.
C.Y.M wrote:
With the latest patch to mplayer, the following changes to mplayer.sh work for me.. :) Thanks. Of course more file type cases should be added (like the one for AVI) if you want to use the default AID configuration. Now I can use mplayers default AID auto detection, or I can set the AID of my choice.
C.
--- mplayer.sh 2004-11-06 13:00:00.000000000 -0800 +++ /etc/vdr/plugins/mplayer.sh 2005-07-02 12:30:33.000000000 -0700 @@ -178,7 +178,7 @@ if test -z "$VO"; then errorcfg VO; exit; else debugvar VO "$VO"; fi
if test -z "$AO"; then errorcfg AO; exit; else debugvar AO "$AO"; fi - AOUT="-ao $AO" + AOUT="-ao $AO $AID"
if test -z $CACHE; then echolog "*** Option CACHE not set in config file - calling mplayer without Cache!" @@ -481,7 +481,16 @@ declare ORIG_FPS NEW_FPS ORIG_ASPECT VIDEO_FORMAT AUDIO_CODEC declare CMDLINE AOUT REMOTE USERDEF SUFFIX declare FILE="$1" -declare SLAVE="$2" +declare DETECT="1" +while shift; do + if [ "$1" = "SLAVE" ]; then + declare SLAVE="$1" + elif [ "$1" = "AID" ]; then + declare AID="-aid $2" + declare DETECT="0" + shift + fi +done declare -a XResPAL[0] declare -a XResNTSC[0] declare FDSTR="" @@ -540,11 +549,16 @@ choosebesty if test $NEW_X -eq 0 -o $NEW_Y -eq 0; then echolog "*** FATAL: Illegal Resolution ..."; exit; fi
+ if test $DETECT == "0" -a ( $VIDEO_FORMAT == "DIV3" -o $VIDEO_FORMAT == "XVID" ) ; then + echolog "*** INFO: AVI file format detected. Setting AID to 1" + AOUT="-ao $AO -aid 1" + fi + if test $MPEG_DIRECT == "true" -a ( $VIDEO_FORMAT == "0x10000001" -o $VIDEO_FORMAT == "0x10000002" ) -a ( \ ( $PAL -a $NEW_FPS == "25" -a ( ( $ORIG_X == "352" -a $ORIG_Y == "288" ) -o ( $ORIG_Y == "576" -a \ ( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "528" -o $ORIG_X == "544" -o $ORIG_X == "688" -o $ORIG_X == "704" -o $ORIG_X == "720" ) ) ) ) -o \ ( $NTSC -a $NEW_FPS == "30" -a ( ( $ORIG_X == "352" -a $ORIG_Y == "240" ) -o ( $ORIG_Y == "480" -a \ - ( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "512" -o $ORIG_X == "640" -o $ORIG_X == "704" -o $ORIG_X == "720" ) ) ) ) \ + ( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "512" -o $ORIG_X == "544" -o $ORIG_X == "640" -o $ORIG_X == "704" -o $ORIG_X == "720" ) ) ) ) \ ) ; then CMDLINE="$MPLAYER -vo $VO $AOUT $FDSTR $CACHESTR $REMOTE $USERDEF" else
On 02 Jul 2005 Juri Haberland list-linux.vdr@koschikode.com wrote:
[...]
Please, Stefan, remove this mess - it was a mistake to implement it in the first place...
I don't see a need to remove it. If you don't want to use it, you can simply leave the AID set to default or use a mplayer.sh which doesn't parse it.
Or did I miss something?
Regards.