NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Other Clients Old Stuff (legacy) MVP & NMT v
« Previous 1 … 80 81 82 83 84 … 115 Next »
Anyone tried playing .avs files yet (AviSynth)?

 
  • 0 Vote(s) - 0 Average
Anyone tried playing .avs files yet (AviSynth)?
LilY0da
Offline

Senior Member

Posts: 442
Threads: 25
Joined: Jul 2005
#11
2005-09-22, 02:52 AM
you need to add AVS in the main setting page of VA, then it works
Spartan
Offline

Senior Member

Posts: 457
Threads: 28
Joined: Mar 2005
#12
2005-09-22, 03:49 PM
LilY0da Wrote:you need to add AVS in the main setting page of VA, then it works

OMG -- I can't believe I forgot to do that! :o

Awesome! It works like a charm now!
GBPVR v1.0.16 | Comskip | SportsScores | Weather | I-XmlTV

Server: Tyan Thunder h1000E | 2 x Opteron 2210 | 2GB PC2-5300 DDR2 ECC
LSI MegaRAID 300-8X SATA RAID
1x 73GB SCSI @ 10K RPM (OS)
3x 500GB SATA @ 7.2K RPM (RAID 5) (4 Partitions: Docs, Still Pics, Home Movies, Music)
2x 160GB IDE @ 7.2K RPM (RAID 0) (Recordings)
Hauppauge HVR-1600

Client: Gigabyte GA-MA69GM-S2H | Athlon x2 5000+ BE | 2GB PC-6400 DDR2
1x 320GB SATA @ 7.2K RPM
Antec NSX2480 Case
MCE Remote
phonicfrog
Offline

Junior Member

Posts: 8
Threads: 0
Joined: Jun 2005
#13
2005-10-27, 03:17 PM
I uninstalled ffdshow, installed xvid codec & avisynth & created a simple avs file to test. My source was 29.97FPS & 640x480 which I converted to 25FPS and resized to 352x288 in the script.
For the first time I was able to watch a complete xvid encoded show on my mvp with no crashes and a decent enough picture.

I can use the following code from the command prompt to auto create .avs files for avi's in a directory but I don't know how to make this recurse through sub-directories.

for %x in (*.avi) do (
echo.aviSource^("%x"^)
echo.BilinearResize^(352,288^)
echo.convertfps(25^)
) > "%~nx.avs"


I have hundreds of avi files stored in dozens of sub-directories. Does anyone know of an easy way to batch create .avs files?
LilY0da
Offline

Senior Member

Posts: 442
Threads: 25
Joined: Jul 2005
#14
2005-10-27, 03:48 PM
Google for a small utility called "ScriptWriter", I think it has recursive capabilities.
jpenninkhof
Offline

Junior Member

Posts: 6
Threads: 0
Joined: Sep 2005
#15
2005-11-03, 12:35 PM
I can recall that we'v discussed playing avs files in another thread before. Now this is really possible, it seems to work like a charm indeed. It works so well that I would even recommend to always play AVI files through Avisynth. Sub, perhaps you can add a little avs generator to the transmvp script that is invoked when you click on an avi on the mvp.

The reason why it works awesome for me is because it takes care of the out-of-sync audio, which was caused by the framerate (the framerate of the avi must correspond with the framerate of the MVP box, e.g. PAL = 25).
At the same time it also takes care of the issue that I had that my PC was just fast enough to transcode quite some AVI, but not all. I solved this by scaling the movie resolution down to VCD format, which gives the MPEG encoder a much easier job.
Another issue that I tackled with this is the borders around the movie. In some occasions the movie was always in the top of the screen. By getting some borders in the movie, so that it already has a PAL (in my case) aspect ration, the movie is now always nicely displayed in the middle of the screen.

In fact, the AVS solutions worked so well for me, that I'm playing my movies from a shadow directory that's built up with a PHP script. In that directory, there are symlinks to the MPGs and it contains AVS-files to link to the AVIs.

Oh, just a tip for this to work: I have the feeling that the MPEG encoder that GBPVR is using only accepts resolutions with even numbers. So if you create AVS files, make sure that the resolution isn't 101 x 51, but 100 x 50 instead (just an example).

Great work Sub, and it's really a wonderful effort that GBPVR supports this now. I'm sure it will solve a lot of folks' frustration converting their entire movie collection Smile
jrockintuitive
Offline

Senior Member

Posts: 292
Threads: 19
Joined: Dec 2004
#16
2005-11-03, 12:55 PM
I use the code below, in a batch file, for all of my transcoding. It works flawlessly

Code:
> "%~dpn1.avs"   ECHO AVISource(%1)
>> "%~dpn1.avs"   ECHO ConvertToYUY2
>> "%~dpn1.avs"   ECHO ConvertFPS(29.97)
"C:\Program Files\devnz\gbpvr\trans2mvp" "%~dpn1.avs" "%~dpn1.mpg"
del "%~dpn1.avs"
jpenninkhof
Offline

Junior Member

Posts: 6
Threads: 0
Joined: Sep 2005
#17
2005-11-03, 01:13 PM
I have something similar.

It's just that I'm using directshowsource to open the file, because I have some files with AC3 and I'm using a bicubicresize, which is dependent on the resolution on the movie.

I'm actually generating my AVS files with a PHP script and read the movie properties (resolution and framerate) with the open source library getid3.

Apart from that, I'm including my own borders (instead of letting the MVP figuring the borders out) to make the movie fit the 3:4 TV screen and display the subtitle in the bottom border using vobsub.

Great solutions, and it displays everything at my side also exactly the way I want Smile
LilY0da
Offline

Senior Member

Posts: 442
Threads: 25
Joined: Jul 2005
#18
2005-11-03, 01:41 PM
* LilY0da wants the php code
please please please
jpenninkhof
Offline

Junior Member

Posts: 6
Threads: 0
Joined: Sep 2005
#19
2005-11-03, 11:45 PM
LilY0da Wrote:/me wants the php code
please please please
O dear... First a couple of disclaimers then:
  • I've used PHP for quick and dirty scripting, this is not nicely written code. It does work for me though, and runs every now and then automatically through cron.
  • It's running on a Linux box, so if you're running this on Windows, you'll definately have to do something about the symlinks for .mpg-files
  • A lot of variables such as resolution, aspect ratio, frame rate etc are hard-coded.
Bottom line: it may get you started, but you need to write your own Wink

A little explanation:
  • The $frompath and $topath are internal paths on the linux box that's running the script.
  • The $refpath is the path that would appear in the avs-files. This is a samba-share, because the files are transcoded on my desktop (gbpvr needs to run on a windows PC).
About the functions:
  • Processfile(): does the work for 1 file: reads the AVI and builds up the script (in a string).
  • Searchdir(): gets all directory entries (recursively) in a path. I've limited this to a path depth of 5 (and not infinite), because I'm sometimes a bit sloppy with my symlinks and do want the script to end sometime Wink. Comes from http://www.php.net/dir.
  • string2file(): Writes a string to a file. Comes from http://www.php.net/function.file
Code:
<?php

$frompath = '/data/video/';
$refpath = '\\\\192.168.0.3\\video\\';
$topath = '/data/avs/';

$files = searchdir($frompath, 5);
foreach ($files as $file) {
    $filename = substr($file, strlen($frompath));
    if (substr($filename, strrpos($filename,'.')+1) == "avi")
        String2File(processfile($frompath, $refpath, $filename), $topath . substr($filename,0,strlen($filename)-3) . 'avs' );
    elseif (substr($filename, strrpos($filename,'.')+1) == "mpg") {
        @mkdir(substr($topath . $filename, 0, strrpos($topath . $filename,'/')), 0777, True);
        @symlink($frompath . $filename, $topath . $filename);
    }
}

function processfile($frompath, $refpath, $filename) {
    $retval = "";
    require_once('getid3/getid3.php');
    $getid3 = new getID3;
    $getid3->encoding = 'UTF-8';
    try {
        $getid3->Analyze($frompath . $filename);
        $retval .= '# File:             ' . @$getid3->filename . "\r\n";
        $retval .= '# Playtime:         ' . @$getid3->info['playtime_string']  . "\r\n";
        $retval .= "#\r\n";
        $retval .= '# - Format:         ' . @$getid3->info['video']['fourcc'] . "\r\n";
        $retval .= '# - Codec:          ' . @$getid3->info['video']['codec'] . "\r\n";
        $retval .= '# - Mode:           ' . @$getid3->info['video']['bitrate_mode'] . "\r\n";
        $retval .= '# - Resolution:     ' . @$getid3->info['video']['resolution_x'] . ' x ' . @$getid3->info['video']['resolution_y'] . "\r\n";
        $retval .= '# - Frame rate:     ' . @$getid3->info['video']['frame_rate'] . "\r\n";
        $retval .= '# - Bit-rate:       ' . @$getid3->info['video']['bitrate'] . "\r\n";
        $retval .= '# - Aspect ratio:   ' . @$getid3->info['video']['pixel_aspect_ratio'] . "\r\n";
        $retval .= '# - Frame rate:     ' . @$getid3->info['video']['frame_rate'] . "\r\n";
        $retval .= '# - Total frames:   ' . @$getid3->info['video']['total_frames'] . "\r\n";
        $retval .= "#\r\n";
        $retval .= "# Audio:\r\n";
        $retval .= '# - Format:         ' . @$getid3->info['audio']['dataformat'] . "\r\n";
        $retval .= '# - Codec:          ' . @$getid3->info['audio']['codec'] . "\r\n";
        $retval .= '# - Channels:       ' . @$getid3->info['audio']['channels'] . "\r\n";
        $retval .= '# - Sample rate:    ' . @$getid3->info['audio']['sample_rate'] . "\r\n";
        $retval .= '# - Bitrate:        ' . @$getid3->info['audio']['bitrate'] . "\r\n\r\n";
        $retval .= 'DirectShowSource("' . $refpath . str_replace('/', '\\', $filename) . '", ' . @$getid3->info['video']['frame_rate'] . ")\r\n";
        $vidheight = round(( 1.22222 * 352 * @$getid3->info['video']['resolution_y'] ) / @$getid3->info['video']['resolution_x']);
        if ($vidheight % 2) $vidheight--;
        if ($vidheight > 288) $vidheight = 288;
        $vidborder = (288 - $vidheight) / 2;
        $retval .= "BicubicResize(352, $vidheight, 0, 0.75)\r\n";
        $retval .= "ChangeFPS(25)\r\n";
        $retval .= "AddBorders(0, $vidborder, 0, $vidborder)\r\n";
    }
    catch (Exception $e) {
        $retval .= 'An error occured: ' .  $e->message;
    }
    return $retval;        
}

function searchdir ( $path , $maxdepth = -1 , $mode = "FULL" , $d = 0 )
{
   if ( substr ( $path , strlen ( $path ) - 1 ) != '/' ) { $path .= '/' ; }        
   $dirlist = array () ;
   if ( $mode != "FILES" ) { $dirlist[] = $path ; }
   if ( $handle = opendir ( $path ) )
   {
       while ( false !== ( $file = readdir ( $handle ) ) )
       {
           if ( $file != '.' && $file != '..' )
           {
               $file = $path . $file ;
               if ( ! is_dir ( $file ) ) { if ( $mode != "DIRS" ) { $dirlist[] = $file ; } }
               elseif ( $d >=0 && $d < $maxdepth )
               {
                   $result = searchdir ( $file . '/' , $maxdepth , $mode , $d + 1 ) ;
                   $dirlist = array_merge ( $dirlist , $result ) ;
               }
       }
       }
       closedir ( $handle ) ;
   }
   if ( $d == 0 ) { natcasesort ( $dirlist ) ; }
   return ( $dirlist ) ;
}

function String2File($sIn, $sFileOut) {
  $rc = false;
  @mkdir(substr($sFileOut, 0, strrpos($sFileOut,'/')), 0777, True);
  do {
   if (!($f = fopen($sFileOut, "wa+"))) {
     $rc = 1; break;
   }
   if (!fwrite($f, $sIn)) {
     $rc = 2; break;
   }
   $rc = true;
  } while (0);
  if ($f) {
   fclose($f);
  }
  return ($rc);
}

?>
You can get the open source getid3 library from http://getid3.sourceforge.net/.

The subtitle version is still work-in-progress, but it's quite simple: Just check for a .str file and then add two lines to your AVS:
Code:
LoadPlugin("C:\path-to-vsfilter\VSFilter.dll")
TextSub("\\path\to\your\srt-file.srt")
The LoadPlugin line goes into the top somewhere
The TextSub goes below the AddBorders, so that the subtitles are displayed in the bottom-border.
LilY0da
Offline

Senior Member

Posts: 442
Threads: 25
Joined: Jul 2005
#20
2005-11-04, 03:48 AM
/hug
Besides the IP and the paths, looks like I can use it almost as is.
/re-hug, with complimentary /bow

PS: you code less dirty than I do
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (4): « Previous 1 2 3 4 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mucic not playing complete tracks Jaggy 8 6,833 2017-03-18, 12:53 AM
Last Post: Jaggy
  Problems Playing on PCH-A100 but OK on the PC jksmurf 34 22,908 2014-09-09, 05:23 AM
Last Post: jksmurf
  No audio on MKV files on the PCH pcostanza 3 3,714 2011-11-22, 02:21 AM
Last Post: pcostanza
  MVP Crashes when playing some video files szkoda 7 4,617 2011-06-30, 11:16 AM
Last Post: HtV
  NMT A100 stopped playing video srhutch 12 5,416 2011-04-30, 02:14 PM
Last Post: srhutch
  Freeze to black screen when stopping wmv, mkv, some avi files jksmurf 6 3,252 2010-03-18, 09:24 PM
Last Post: mvallevand
  Watching .TS files on my MVP, not in GBPVR emulation mode Probedude 1 1,882 2010-03-16, 11:32 AM
Last Post: mvallevand
  No sound playing trailers or other .mpg files through mvp navyblue 3 2,702 2009-05-16, 03:51 AM
Last Post: Pengu
  playing divx file on the PCH (and MVP too)? jksmurf 5 2,399 2009-02-22, 04:29 AM
Last Post: mvallevand
  mvp crash when playing mpg1 karfan 2 1,776 2009-01-07, 05:29 PM
Last Post: karfan

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode