Results 1 to 5 of 5

Thread: mplayer video display from cronjob stop working

  1. #1

    Default mplayer video display from cronjob stop working

    Hi,

    I used this line in my crontab file for almost a year without any problems, but a few days ago it stoped displaying video

    Code:
    0 6 * * * mplayer -fs videopath.mp4  -display :0  > /home/myuser/cron.log 2>&1
    It is playing in the background since I can hear the audio.

    Code:
    MPlayer SVN-r37901-4.8 (C) 2000-2016 MPlayer Team
    Terminal type `unknown' is not defined.
    
    Playing videopath.mp4.
    libavformat version 57.52.100 (internal)
    libavformat file format detected.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0xb4d5da0e0]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
    [lavf] stream 0: video (h264), -vid 0
    [lavf] stream 1: audio (aac), -aid 0, -alang eng
    VIDEO:  [H264]  640x368  24bpp  29.970 fps  1002.6 kbps (122.4 kbyte/s)
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    VO XOverlay need a subdriver
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    Can't open /dev/fb0: Permission denied
    [fbdev2] Can't open /dev/fb0: Permission denied
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    VO: [v4l2] No such file or directory
    No vidix driver name provided, probing available ones (-v option for details)!
    No protocol specified
    vo: couldn't open the X11 display (:0)!
    vo_cvidix: No vidix driver name provided, probing available ones (-v option for details)!
    [cyberblade] Error occurred during pci scan: Operation not permitted
    [mach64] Error occurred during pci scan: Operation not permitted
    [mga] Error occurred during pci scan: Operation not permitted
    [mga] Error occurred during pci scan: Operation not permitted
    [nvidia_vid] Error occurred during pci scan: Operation not permitted
    [pm3] Error occurred during pci scan: Operation not permitted
    [radeon] Error occurred during pci scan: Operation not permitted
    [rage128] Error occurred during pci scan: Operation not permitted
    [s3_vid] Error occurred during pci scan: Operation not permitted
    [SiS] Error occurred during pci scan: Operation not permitted
    [unichrome] Error occurred during pci scan: Operation not permitted
    I googled it, and sincerely I didn't understand much of the suggestions. I get scare whenever the Xorg server and permitions are implicated.

    Please, help me find out what I should change to get it working again.

  2. #2

    Default Re: mplayer video display from cronjob stop working

    Cron is not really that useful for gui apps because you never know whether the cron command runs with a full set of environment vars. Your mplayer is probably missing XAUTHORITY. Try to fetch it and make it known to the shell that runs mplayer

    Code:
    export DISPLAY=:0 && export $(grep -z XAUTHORITY /proc/$(pgrep kwin)/environ ) && mplayer -fs videopath.mp4  > /home/myuser/cron.log 2>&1
    That will obviously only work for KDE since the pgrep looks for kwin.

    Personally, I would go for autostart desktop files instead of cron.

  3. #3

    Default Re: mplayer video display from cronjob stop working

    Quote Originally Posted by markdd View Post
    Cron is not really that useful for gui apps because you never know whether the cron command runs with a full set of environment vars. Your mplayer is probably missing XAUTHORITY. Try to fetch it and make it known to the shell that runs mplayer
    Thanks for the reply. You might be right my Xauthority file is named Xauthority-n in my home folder but it is empty. Sadly I'm not using Kde, so I couldn't try your suggestion.
    I'm trying to figure out the relationship between Xauthority and mplayer.

  4. #4

    Default Re: mplayer video display from cronjob stop working

    If you know what your current XAUTHORITY is, then you can simply pass that to the shell. The script I use is just a sophisticated way of saying "use the Xauthority my window manager uses". There probably are other ways. Simplest way is to hardcode it just like you did with the display num.

    Code:
    export DISPLAY=:0 && export XAUTHORITY=/home/<user>/.Xauthority-n && mplayer -fs videopath.mp4  > /home/myuser/cron.log 2>&1

  5. #5

    Default Re: mplayer video display from cronjob stop working

    I made it. It is working now.
    Here are the steps I used
    1. I made sure the cron job was of the logged user with
      Code:
      $crontab -u myuser -l
    2. I didn't have a ~/.Xauthority file, but a ~/.Xauthority-n that was empty, then how could I lunch all the graphical applications?, so I check if the authorization cookie existed with
      Code:
      $xauth list
    3. I exported it to the empty ~/.Xauthority-n file
      Code:
      $export XAUTHORITY=~/.Xauthority-n
    4. I freaked out because after that I couldn't lunch anything graphical. All my intents resulted in the same error
      Code:
      No protocol specified
    5. I crossed my fingers, logged out and logged in. Everything is working smoothly even the mplayer cronjob.
    6. Now I have a ~/.Xauthority file instead of ~/.Xauthority-n


    As I said I don't know how Xorg or Xauthority work, so if someone could explain how this worked out, it would be great.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •