Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Programming and Hacking > Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th October 2002, 03:54   #1  |  Link
Emp3r0r
Registered User
 
Emp3r0r's Avatar
 
Join Date: Oct 2001
Location: Alabama, USA
Posts: 769
Command Line Compressor - AVS2AVI

Quote:
EDIT DaveEL:
Latest version of avs2avi currently is http://daveel.leffe.dnsalias.com/avs2avi-131a.zip
Just to save you reading the entire thread.
I am looking for a commandline style program that would take a input.avs file and a target output.avi and then prompt you with this: http://jvance.com/images/videocompression.gif

I've already attempted the project myself but I still don't know enough C++ or the VCM interfaces to take "store.c" from DVD2AVI and create the app. Maybe something like this already exists or someone thinks it wouldn't be that hard to whip it up.

Additionally, Nic provided me with the following help: "For encoding to avi, you need to learn the AVI API & IC API to do it yourself. Look up commands like AVIGetStream & ICCompress. Basically you do an AVIReadStream from an avs file. That gives you the YUY2 frame in a buffer, then call ICCompress to get the compressed frame & then use AVIWrite (I think DVD2AVI is the place to look )"

Thanks Nic and anyone else who may provide help.
__________________
ChapterGrabber - add names to your chapters | AtomSite - open source AtomPub server

Last edited by DaveEL; 12th August 2003 at 17:54.
Emp3r0r is offline   Reply With Quote
Old 1st November 2002, 15:03   #2  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
Look to M4C sources.
int 21h is offline   Reply With Quote
Old 1st November 2002, 22:15   #3  |  Link
Emp3r0r
Registered User
 
Emp3r0r's Avatar
 
Join Date: Oct 2001
Location: Alabama, USA
Posts: 769
Thanks and I looked at the code but I just found out in my C++ class that you can set a method()=value and it kinda blew my mind but anyway, my c++ skills are horrible so I think I will wait for DirectX.NET
__________________
ChapterGrabber - add names to your chapters | AtomSite - open source AtomPub server
Emp3r0r is offline   Reply With Quote
Old 2nd November 2002, 21:48   #4  |  Link
[Toff]
Registered User
 
Join Date: Oct 2001
Location: FRANCE
Posts: 320
Here is a surprise for you in attachement.

It should work with RGB24, RGB32, YUY2 and YV12 avs source.

It compress well with DivX 3.11, but it crash at the end with DivX5 and XviD, on the last :
AVIFileRelease(pSRCfile);
I don't now why ATM, I will look at it later. The file is still readable anyway at start

Source are included, if any vfw guru want to look at it ?

EDIT : Attachement removed (see below for new version)
__________________
Regards [Toff]

Last edited by [Toff]; 4th November 2002 at 12:36.
[Toff] is offline   Reply With Quote
Old 3rd November 2002, 11:45   #5  |  Link
[Toff]
Registered User
 
Join Date: Oct 2001
Location: FRANCE
Posts: 320
I found what the crash problem is.
Line 195 :
if(pDSTCompVideoStream)
AVIStreamRelease(pDSTVideoStream);
Must be :
if(pDSTCompVideoStream)
AVIStreamRelease(pDSTCompVideoStream);

No crash anymore.

Even if the avi seems perfectly playable there is still a problem at the end of the stream (an invalid chunk, that's what vdub say when using the hexeditor and Riff chunk tree)
The problem is also present in DVD2AVI.

EDIT : Oups, a new problem fixed all frames were written as KF, new upload soon. It's seems that RGB support is broken, I must test with a stable avisynth version.
__________________
Regards [Toff]

Last edited by [Toff]; 3rd November 2002 at 13:59.
[Toff] is offline   Reply With Quote
Old 3rd November 2002, 15:39   #6  |  Link
[Toff]
Registered User
 
Join Date: Oct 2001
Location: FRANCE
Posts: 320
OK here is 1.01 version

Tested with avisynth 2.06, RGB24,32,YUY2 works compressing to Xvid, DIvX5 or DivX 3.11.

Tested with avisynth 2.5alpha YUY2, YV12 works.
But RGB seems broken with 2.5 alpha.
I can post a short clip If you want.
EDIT : no bug, I must put ConvertToYUY2 before ConvertToRGB24

Ctrl-C terminate properly now.

EDIT : Attachement removed (see below for new version)
__________________
Regards [Toff]

Last edited by [Toff]; 8th November 2002 at 10:13.
[Toff] is offline   Reply With Quote
Old 4th November 2002, 05:42   #7  |  Link
Emp3r0r
Registered User
 
Emp3r0r's Avatar
 
Join Date: Oct 2001
Location: Alabama, USA
Posts: 769
Thanks [Toff]

Your awesome! I appreciate your work! I will start testing right away. Thanks again.
__________________
ChapterGrabber - add names to your chapters | AtomSite - open source AtomPub server
Emp3r0r is offline   Reply With Quote
Old 4th November 2002, 05:57   #8  |  Link
Emp3r0r
Registered User
 
Emp3r0r's Avatar
 
Join Date: Oct 2001
Location: Alabama, USA
Posts: 769
Great work [Toff]! This is exactly what I was looking for! If you ever get time could you display the FPS during the encode? Also, how do learn how to read/create/modify a codec parameters file?

PS: or just tell it to use xvid since i can change those parameters in the registry.
__________________
ChapterGrabber - add names to your chapters | AtomSite - open source AtomPub server
Emp3r0r is offline   Reply With Quote
Old 4th November 2002, 06:17   #9  |  Link
Emp3r0r
Registered User
 
Emp3r0r's Avatar
 
Join Date: Oct 2001
Location: Alabama, USA
Posts: 769
I guess I must wait for mod to approve your version 1.01?
__________________
ChapterGrabber - add names to your chapters | AtomSite - open source AtomPub server
Emp3r0r is offline   Reply With Quote
Old 4th November 2002, 10:18   #10  |  Link
[Toff]
Registered User
 
Join Date: Oct 2001
Location: FRANCE
Posts: 320
>I guess I must wait for mod to approve your version 1.01?
Yes, just have to wait.

>If you ever get time could you display the FPS during the encode
Yes that should be easy, I will add an estimated time also.

>Also, how do learn how to read/create/modify a codec parameters file
The file that is created is a raw copy of the codec state so there is no general method to create/modify them. Each codec has is own format.

>or just tell it to use xvid since i can change those parameters in the registry
I think that's possible to make a special case for xvid

There is still a little problem at the end of the file, when you use your media player in loop mode it doesn't loop.
The problem is also present in DVD2AVI.
I let you test.
__________________
Regards [Toff]
[Toff] is offline   Reply With Quote
Old 5th November 2002, 06:52   #11  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
I'll take a look at this later and see about adding some stuff and perhaps compiling with Intel for speed increases (when I'm sober )
int 21h is offline   Reply With Quote
Old 5th November 2002, 16:01   #12  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
I hope [Toff] doesn't mind, but I went ahead and implemented a limited two pass functionality. It works fine, but its limited in that it currently doesn't support the load/save function, if you supply load/save on the commandline and also supply the twopass argument, it should dump you out with the usage. (Sorry I forgot to update the usage printout also)

To activate two pass mode you just supply something like

avs2avi source.avs destination.avi -2

This will, in succession ask for compression codecs, the first will be for the first pass, and the second for the second pass (it will confirm them and display). If they don't match (i.e. you select XviD during one pass and DivX for the second, the program will close, printing an error).

Version number is incremented to 1.10.

I tested this briefly and I'm 99% certain it works and I didn't break anything existing.

http://phreak404.virtualave.net/avs2avi_110.zip
int 21h is offline   Reply With Quote
Old 5th November 2002, 19:02   #13  |  Link
[Toff]
Registered User
 
Join Date: Oct 2001
Location: FRANCE
Posts: 320
No problem, feel free to improve.
Let's go test 2 pass encode now.
__________________
Regards [Toff]
[Toff] is offline   Reply With Quote
Old 5th November 2002, 21:17   #14  |  Link
Emp3r0r
Registered User
 
Emp3r0r's Avatar
 
Join Date: Oct 2001
Location: Alabama, USA
Posts: 769
I must be in heaven. You guys are great! I did some testing with DVD2XCD and I think everything is now in place to create a new GKnot type program since GKnot is very outdated. Thanks, for the work.
__________________
ChapterGrabber - add names to your chapters | AtomSite - open source AtomPub server
Emp3r0r is offline   Reply With Quote
Old 5th November 2002, 23:04   #15  |  Link
io
Registered User
 
Join Date: Oct 2002
Posts: 1
Quote:
Originally posted by [Toff]
Even if the avi seems perfectly playable there is still a problem at the end of the stream (an invalid chunk, that's what vdub say when using the hexeditor and Riff chunk tree)
The problem is also present in DVD2AVI.
i stumbled over the same problem using AviFile. the files created seem to be fine, but virtualdub shows an error in its hex editor and some apps did not like these files. i donot think that it is a bug in the code, because the same behavior is present in other programms using AviFile (especially. the VFW examples from microsoft!).

as far as i can see, there is a block added after the RIFF AVI chunk (directly succeeding the AVI legacy index), but it only contains a portion of the last frame. i guess this is for some strange padding reasons, but i would like to get rid of this stuff!

probably the only way to solve this, is to follow virtualdub/vidomi and code your own version of AviFile. *sigh*
io is offline   Reply With Quote
Old 6th November 2002, 00:27   #16  |  Link
[Toff]
Registered User
 
Join Date: Oct 2001
Location: FRANCE
Posts: 320
Thanks, for your comment io.
So I know it's not entirely my fault.

Here we go for v1.11 with :
- 2 pass load/save mode.
- fps display, and remaining time (not very accurate, don't know why)

avs2avi_111.zip

No use default codec parameter (from registry) without prompt at the moment.
__________________
Regards [Toff]
[Toff] is offline   Reply With Quote
Old 6th November 2002, 01:38   #17  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
I had a v1.11 also, but I've incorporated my additions in to yours once again, so here is v1.12

Changelog
---------
  • ReWrote Option Parsing (Won't mean much to most of you, except you can put your flags in whatever order you want now, source, and destination still need to be 1st and 2nd respectively)
  • Added -q to the flag list, use this to get a 'quiet' mode and supress the frame by frame output (gains about 1fps)
  • Cleaned up program run header a bit to look sexier
  • Fixed potential crash if invalid codec state file was supplied, or if there was a problem opening a file for dumping the state
  • Compiled with Intel compiler (program now requires at least MMX to run), modest speed gain should be seen by some


Last edited by int 21h; 21st November 2002 at 15:07.
int 21h is offline   Reply With Quote
Old 6th November 2002, 02:48   #18  |  Link
unplugged
Registered User
 
unplugged's Avatar
 
Join Date: Oct 2001
Location: Italia
Posts: 412
- Surprised about so simple and so effective! (quality+speed toghether with MPEG2DEC3 YV12 and AVS 2.5a)
- Now I'll use VirtualDub only to find frames boundaries , command-line is more quick to setup!!
- Should be bundled with Avisynth

Thanx Toff!
unplugged is offline   Reply With Quote
Old 6th November 2002, 04:04   #19  |  Link
MaTTeR
AC3 5.1 Addict
 
MaTTeR's Avatar
 
Join Date: Nov 2001
Location: Big Blue Nation_USA
Posts: 2,036
Any chance of multi-threading for the future? *grin* I only ask because otherwise it's going to run much slower on SMP boxes compared to Vdub. Good work guys, can't wait to do some testing.
__________________
Need AC3 & SPDIF setup info?
MaTTeR is offline   Reply With Quote
Old 6th November 2002, 05:10   #20  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
I'll look into it, I'm not familiar with how to synch the threads.
int 21h is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:42.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.