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. |
28th June 2008, 02:24 | #3841 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
unsigned char aux[4] = ""; // only a byte buffer
I don't remember if Megui is C, C+, C++, C-, C#, ... we only need read AudioFormat (Litle Endian 16 bit unsigned) at offset 20 and DtsHeader (Litle Endian 32 bit unsigned) at offset 44. |
28th June 2008, 09:50 | #3843 | Link |
Swallowed in the Sea
Join Date: Oct 2002
Location: Aix-en-Provence, France
Posts: 5,191
|
Here is something more usable in C# :
Code:
Index: AviSynthAudioEncoder.cs =================================================================== --- AviSynthAudioEncoder.cs (revision 570) +++ AviSynthAudioEncoder.cs (working copy) @@ -552,6 +552,46 @@ script.AppendFormat("NicMPG123Source(\"{0}\"){1}", audioJob.Input, Environment.NewLine); break; case ".wav": + FileStream fs = new FileStream(audioJob.Input, FileMode.Open, FileAccess.ReadWrite); + fs.Seek(20, SeekOrigin.Begin); // AudioFormat offset + byte[] aux = new byte[4]; // only a byte buffer + + fs.Read(aux, 1, 2); + UInt16 AudioFormat = (UInt16)(((aux)[0] & 0xff) | ((aux)[1] << 8)); // Or something to read a LE int_16 + + + switch (AudioFormat) + { + + case 0x0001: // PCM Format Int + fs.Seek(44, SeekOrigin.Current); // DtsHeader offset + + fs.Read(aux, 1, 4); + UInt32 DtsHeader = (UInt32)(((aux)[0] & 0xff) | ((aux)[1] << 8) | ((aux)[2] << 16) | ((aux)[3] << 24)); // Or something to read a LE int_32 + + if (DtsHeader == 0xE8001FFF) + { + script.AppendFormat("NicDtsSource(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + break; + } + break; + case 0x0003: // IEEE Float + case 0xFFFE: // WAVE_FORMAT_EXTENSIBLE header + script.AppendFormat("RaWavSource(\"{0}\", 2){1}", audioJob.Input, Environment.NewLine); + break; + case 0x0055: // MPEG Layer 3 + script.AppendFormat("NicMPG123Source(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + break; + case 0x2000: // AC3 + script.AppendFormat("NicAc3Source(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + break; + default: + script.AppendFormat("WavSource(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + break; + } + + fs.Close(); + break; case ".w64": case ".aif": case ".au": edit: doesn't seem to work correctly. WavSource(...) is always returned. Tested with MP3 & AC3... Last edited by Kurtnoise; 28th June 2008 at 10:04. |
28th June 2008, 13:56 | #3844 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
Quote:
Code:
Index: AviSynthAudioEncoder.cs =================================================================== --- AviSynthAudioEncoder.cs (revision 570) +++ AviSynthAudioEncoder.cs (working copy) @@ -552,6 +552,46 @@ script.AppendFormat("NicMPG123Source(\"{0}\"){1}", audioJob.Input, Environment.NewLine); break; case ".wav": + BinaryReader r = new BinaryReader(File.Open(audioJob.Input, FileMode.Open)); + + try { + r.ReadBytes(20); + UInt16 AudioFormat = r.ReadUInt16(); // read a LE int_16, offset 20 + 2 = 22 + + switch (AudioFormat) { + case 0x0001: // PCM Format Int + r.ReadBytes(22); // 22 + 22 = 44 + UInt32 DtsHeader = r.ReadUInt32(); // read a LE int_32 + + if (DtsHeader == 0xE8001FFF) + script.AppendFormat("NicDtsSource(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + else + script.AppendFormat("RaWavSource(\"{0}\", 2){1}", audioJob.Input, Environment.NewLine); + break; + case 0x0003: // IEEE Float + case 0xFFFE: // WAVE_FORMAT_EXTENSIBLE header + script.AppendFormat("RaWavSource(\"{0}\", 2){1}", audioJob.Input, Environment.NewLine); + break; + case 0x0055: // MPEG Layer 3 + script.AppendFormat("NicMPG123Source(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + break; + case 0x2000: // AC3 + script.AppendFormat("NicAc3Source(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + break; + default: + script.AppendFormat("WavSource(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + break; + } + } + + catch(EndOfStreamException e) { + Console.WriteLine("{0}, wavfile can't be read.", e.GetType().Name); + } + finally { + r.Close(); + } + + break; case ".w64": case ".aif": case ".au": Last edited by tebasuna51; 28th June 2008 at 15:36. |
|
28th June 2008, 16:00 | #3845 | Link |
Swallowed in the Sea
Join Date: Oct 2002
Location: Aix-en-Provence, France
Posts: 5,191
|
I found something similar...
Code:
Index: AviSynthAudioEncoder.cs =================================================================== --- AviSynthAudioEncoder.cs (revision 570) +++ AviSynthAudioEncoder.cs (working copy) @@ -552,6 +552,52 @@ script.AppendFormat("NicMPG123Source(\"{0}\"){1}", audioJob.Input, Environment.NewLine); break; case ".wav": + using (FileStream fs = new FileStream(audioJob.Input, FileMode.Open, FileAccess.ReadWrite)) + { + using (BinaryReader r = new BinaryReader(fs)) + { + fs.Position = 20; // Offset + UInt16 AudioFormat = r.ReadUInt16(); // read a LE int_16 + + switch (AudioFormat) + { + case 0x0001: // PCM Format Int + fs.Position = 44; // Offset + UInt32 DtsHeader = r.ReadUInt32(); // read a LE int_32 + + if (DtsHeader == 0xE8001FFF) + { + script.AppendFormat("NicDtsSource(\"{0}\"", audioJob.Input); + if (audioJob.Settings.AutoGain) + script.AppendFormat(", DRC=1){0}", Environment.NewLine); + else + script.Append(")"); + break; + } + break; + case 0x0003: // IEEE Float + case 0xFFFE: // WAVE_FORMAT_EXTENSIBLE header + script.AppendFormat("RaWavSource(\"{0}\", 2){1}", audioJob.Input, Environment.NewLine); + break; + case 0x0055: // MPEG Layer 3 + script.AppendFormat("NicMPG123Source(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + break; + case 0x2000: // AC3 + script.AppendFormat("NicAc3Source(\"{0}\"", audioJob.Input); + if (audioJob.Settings.AutoGain) + script.AppendFormat(", DRC=1){0}", Environment.NewLine); + else + script.Append(")"); + break; + default: + script.AppendFormat("WavSource(\"{0}\"){1}", audioJob.Input, Environment.NewLine); + break; + } + r.Close(); + } + fs.Close(); + } + break; case ".w64": case ".aif": case ".au": |
28th June 2008, 16:53 | #3846 | Link |
Registered User
Join Date: Dec 2006
Posts: 523
|
Bug Report - Aspect Ratio, Anamorphic
Seems that the aspect ratio is forgotten or not carried through megui. I transcoded a 16x9 720x480 video from .TS to x264/mp4 last night using a fresh install of latest dev build 0_3_0_1010. Code:
DGIndexProjectFile16 1 P:\New Movies\Hellboy Extras\Minatures - 1 - MPEG2, 480i60.m2v Stream_Type=0 MPEG_Type=2 iDCT_Algorithm=6 YUVRGB_Scale=1 Luminance_Filter=0,0 Clipping=0,0,0,0 Aspect_Ratio=16:9 Picture_Size=720x480 Field_Operation=0 Frame_Rate=29970 (30000/1001) Location=0,0,0,54c3e The mp4 resulted renders as a 3x4 +/- in MPC-HC 580. I dropped the mp4 into mkvmerge, which couldn't determine the aspect ratio, so I specified it as 16x9. The mkv file is rendered correctly. |
29th June 2008, 03:51 | #3847 | Link |
Mr. Sandman
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
|
weird. i just did 2 anamorphic encodes and it works well.
ensure you click the "show DAR" in the preview (main window... not avisynth script creator) to check the AR.
__________________
MPEG-4 ASP Custom Matrices: EQM V1(old), EQM AutoGK Sharpmatrix (aka EQM V2), EQM V3HR (updated 01/10/2004), EQM V3LR, EQM V3ULR (updated 04/02/2005), EQM V3UHR (updated 17/12/2004) and EQM V3EHR (updated 05/10/2004) Info about my ASP matrices. MPEG-4 AVC Custom Matrices: EQM AVC-HR Info about my AVC matrices My x264 builds. Mooo!!! |
29th June 2008, 09:00 | #3848 | Link |
Registered User
Join Date: Apr 2005
Posts: 1,740
|
In AviSynthWindow.openDirectShow(), there is some code which first gets MeGUI to open the file with DirectShow, before telling Avisynth to use DirectShowSource(). I am doing some improvements to the avisynthwindow, and I would like to remove that code.
Is there a reason it is needed? Surely, if it won't render in directshow, then avisynth will tell us that, so there seems no need to check for ourselves first... |
29th June 2008, 16:04 | #3850 | Link |
Swallowed in the Sea
Join Date: Oct 2002
Location: Aix-en-Provence, France
Posts: 5,191
|
guys, I'm tired to support the last DGindex stuff. I tried 2-3 different things, but no one seem to be fine. I hate to code sometimes when nothing work correctly...
So,
Whatever you choose (as target release for the 0.3.xxxx build), both are ok for me. |
30th June 2008, 01:09 | #3851 | Link |
Registered User
Join Date: Apr 2005
Posts: 1,740
|
I think we should go for the former. We will have to upgrade DGIndex sometime anyway (as the old version simply becomes obsolete) and I would be afraid about .d2v file format discrepancies if we supported a different version of DGIndex and DGDecode.dll.
|
30th June 2008, 03:49 | #3852 | Link |
Mr. Sandman
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
|
the former. however i would like to try something first.
__________________
MPEG-4 ASP Custom Matrices: EQM V1(old), EQM AutoGK Sharpmatrix (aka EQM V2), EQM V3HR (updated 01/10/2004), EQM V3LR, EQM V3ULR (updated 04/02/2005), EQM V3UHR (updated 17/12/2004) and EQM V3EHR (updated 05/10/2004) Info about my ASP matrices. MPEG-4 AVC Custom Matrices: EQM AVC-HR Info about my AVC matrices My x264 builds. Mooo!!! |
30th June 2008, 06:54 | #3853 | Link | ||
Banned
Join Date: Feb 2007
Posts: 124
|
For some reason when I try to load an Avisynth script into Megui, I get an error.
Here is a picture of the error. Directly following the error, Megui crashes and this is what Windows Vista has to say about it. Quote:
The AviSynth script loads into VirtualDub without fuss, Megui just will not take it. Oh, and here is the contents of the AviSynth Script: Quote:
Help? -Neil Last edited by Neillithan; 30th June 2008 at 06:59. |
||
30th June 2008, 14:39 | #3854 | Link |
Mr. Sandman
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
|
check the avs in virtualdub. if it doesnt work you dont have the VFW codec installed.
avisource needs VFW codecs...
__________________
MPEG-4 ASP Custom Matrices: EQM V1(old), EQM AutoGK Sharpmatrix (aka EQM V2), EQM V3HR (updated 01/10/2004), EQM V3LR, EQM V3ULR (updated 04/02/2005), EQM V3UHR (updated 17/12/2004) and EQM V3EHR (updated 05/10/2004) Info about my ASP matrices. MPEG-4 AVC Custom Matrices: EQM AVC-HR Info about my AVC matrices My x264 builds. Mooo!!! |
30th June 2008, 16:53 | #3855 | Link |
Mr. Sandman
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
|
@devs: let's proceed removing the audio track selection in the d2v creator so we can update dgindex. i will readd it later if my code works correctly.
__________________
MPEG-4 ASP Custom Matrices: EQM V1(old), EQM AutoGK Sharpmatrix (aka EQM V2), EQM V3HR (updated 01/10/2004), EQM V3LR, EQM V3ULR (updated 04/02/2005), EQM V3UHR (updated 17/12/2004) and EQM V3EHR (updated 05/10/2004) Info about my ASP matrices. MPEG-4 AVC Custom Matrices: EQM AVC-HR Info about my AVC matrices My x264 builds. Mooo!!! Last edited by Sharktooth; 30th June 2008 at 17:20. |
30th June 2008, 23:52 | #3856 | Link | |||
Banned
Join Date: Feb 2007
Posts: 124
|
Quote:
I said this. Quote:
Quote:
-Neil Last edited by Neillithan; 30th June 2008 at 23:55. |
|||
1st July 2008, 03:48 | #3857 | Link |
Mr. Sandman
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
|
sorry. my short term memory sometimes is really short...
so, let try another thing. get the megui dev version and give it a try, just dont use zones (seems its buggy). if the problem persists, we should find the cause.
__________________
MPEG-4 ASP Custom Matrices: EQM V1(old), EQM AutoGK Sharpmatrix (aka EQM V2), EQM V3HR (updated 01/10/2004), EQM V3LR, EQM V3ULR (updated 04/02/2005), EQM V3UHR (updated 17/12/2004) and EQM V3EHR (updated 05/10/2004) Info about my ASP matrices. MPEG-4 AVC Custom Matrices: EQM AVC-HR Info about my AVC matrices My x264 builds. Mooo!!! |
1st July 2008, 06:43 | #3859 | Link | |
Banned
Join Date: Feb 2007
Posts: 124
|
Quote:
Your suggestion worked! The Developer version of MeGUI opens the AviSynth script in Megui just fine. Version 0.3.0.1010 opened right up without any problems. Thanks a lot. Edit: After closer inspection, I think the reason why it didn't work was because there was no path set for "Avisynth Plugins" in the Program Path's area of Megui Settings. lol Oh well! Last edited by Neillithan; 1st July 2008 at 07:02. |
|
Tags |
development, megui, not a help thread |
Thread Tools | Search this Thread |
Display Modes | |
|
|