Playing .dat video file from a cd or dvd

Sometimes .dat video files wont play by double clicking on it neither in vlc nor in totem player. This script play .dat video files from a cd or dvd one after the another in mplayer.

For installing mplayer run in terminal sudo apt-get install mplayer  or install it through Software Center ( Ubuntu ) or Add/Remove Software ( Fedora ).


-------------------------------------------------------------------------------------------------------------------------------------------------
HOW THIS SCRIPT WORKS:
'mount' command will display all the drives loaded.
If disk drive is loaded , mount command will display it as /dev/sr0.
When the disk is loaded script will check number of .dat files , dat files are placed in  'mpegav' folder in the cd.
Then the dat files are played one after the other with mplayer
-------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
#!/bin/bash

#for running .dat file

#getting path of the mpegav file in cd
name=$(mount | grep "sr0" |cut -d / -f 4,5 | cut -d " " -f 1)

#check to find whether cd is loaded
if [[ "$name" != "$null" ]];then
     count=$(find /$name/mpegav/ -nowarn -type f | wc -l)
fi

#playing .dat file or sending warning
if [[ $count != $null ]];then
     i=2
     count=$((count + 1))
     while [ $i -le $count ];do
          mplayer -cdrom-device /dev/cdrom vcd://$i

          i=$((i + 1))

           clear
     done
else
     clear
           echo "vcd not loaded or not present!!!"
     sleep 1
fi

-------------------------------------------------------------------------------------------


Now, who said we need Windows to play .dat file ..??

Enjoy Linux


Don't know what to do with these codes ??  click here

1 comment: