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 > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th July 2010, 22:06   #1  |  Link
Boogerlad
Registered User
 
Join Date: Oct 2009
Posts: 24
Ideal for fraps?

Hey, I'm working on trying to convert fraps footage to x264+aac in mp4 container using just the command line, x264.exe, avisynth, propriety nero aac encoder and yamb to mux video and audio stream. First off, are these the right tools for the job? Are there better alternatives?

However, with avisynth, I noticed there's many ways to input the video. There's avisource and directshowsource. Which one do I use?
I think you also need ConvertToYV12() at the end of the script because x264 likes that and fraps is rgb32 right? Is there much quality loss?

**Forgive me if this is in the wrong section. Mods move if needed.**
Boogerlad is offline   Reply With Quote
Old 22nd July 2010, 20:32   #2  |  Link
Boogerlad
Registered User
 
Join Date: Oct 2009
Posts: 24
anyone use avisynth and fraps?
Boogerlad is offline   Reply With Quote
Old 22nd July 2010, 21:05   #3  |  Link
Robert Martens
Registered User
 
Join Date: Feb 2010
Location: New York
Posts: 116
I've had excellent results with a similar setup for some Audiosurf videos I've recorded (for example: http://www.youtube.com/watch?v=Q7or1c6UdxA), and though that's only been to stitch split file captures together, I've got no reason to think more complex processing would present a problem.

AVISource works quite well for me, the Fraps codec is Video for Windows if I'm not mistaken. If you have some need to access the files through DirectShow, there's always ffdshow.

I honestly don't know what difference there would be between using ConvertToYV12() in AviSynth and letting x264 handle the conversion. In either case the quality drop is barely perceptible. Comparing my original Audiosurf recordings and an x264 lossless YV12 version side by side I can see a slight drop in sharpness (I cannot emphasize the word "slight" enough), but then again the game is running with no antialiasing, and I'm comparing individual frames, so the difference is that much more noticeable. I wouldn't worry about it, especially when the images are in motion.

As far as compression, I've been mostly using Staxrip for my videos, though lately I've been practicing doing it by hand (command line x264, BeHappy for audio, mkvtoolnix or Yamb to mux everything). Perfectly suitable tools, I'd say. Your workflow sounds fine to me.
Robert Martens is offline   Reply With Quote
Old 23rd July 2010, 00:57   #4  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,416
AVISource is the way to go here. The FRAPS codec has a perfectly good VFW decoder, and it works fine. I've used it plenty of times

I'd do the YV12 conversion in AviSynth, like this:

ConvertToYV12(matrix="PC.709")

This will use the Rec709 standard, but also use the full PC range (0-255). If you don't want full range, then change the matrix to "Rec709" and you will get standard "TV" levels (16-235).

There certainly is a quality loss when you go to 4:2:0 chroma subsampling from RGB. The difference is mathematically huge (hence why it's used in the first place!!!), but perceptibly not too bad. Our eyes are fairly terrible at receiving color

I'd use the AviSynth plugin SoundOut to get audio out of your AVI and into a WAV. I'd then use eac3to to encode this WAV to AAC. eac3to uses Nero's AAC encoder, which performs very well.
Blue_MiSfit is offline   Reply With Quote
Old 23rd July 2010, 02:52   #5  |  Link
Boogerlad
Registered User
 
Join Date: Oct 2009
Posts: 24
thanks for the help guys. Also, if there are multiple files since fraps saves in non opendml avi files, will appending them cause a loss in audio-video sync?
Boogerlad is offline   Reply With Quote
Old 23rd July 2010, 02:59   #6  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,416
It shouldn't, especially since FRAPS writes PCM audio, which is inherently CBR.

Derek
Blue_MiSfit is offline   Reply With Quote
Old 23rd July 2010, 06:29   #7  |  Link
PhrostByte
Grand Fruitioner
 
PhrostByte's Avatar
 
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
FRAPS has two encoding modes: RGB and full range YV12. But it only decodes to RGB. If you're encoding as YV12, you should use FFVideoSource to prevent another colorspace conversion.

And yes, you can append multiple FRAPS videos without any problems. I do it all the time
PhrostByte is offline   Reply With Quote
Old 23rd July 2010, 07:05   #8  |  Link
Boogerlad
Registered User
 
Join Date: Oct 2009
Posts: 24
Would I use to + or ++ operator to join files? I'm thinking aligned splice?
http://avisynth.org/mediawiki/Splice
Boogerlad is offline   Reply With Quote
Old 23rd July 2010, 16:33   #9  |  Link
Boogerlad
Registered User
 
Join Date: Oct 2009
Posts: 24
wait, so if you check "force lossless rgb capture (may be slower)" than it records in rgb32, else in yv12? If so, is avisynth even necassary unless you want to do other processing? Could you just feed x264.exe the raw fraps footage?
Boogerlad is offline   Reply With Quote
Old 23rd July 2010, 17:41   #10  |  Link
PhrostByte
Grand Fruitioner
 
PhrostByte's Avatar
 
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
Yes, you can give x264 (if compiled with ffms2) raw FRAPS footage without avisynth in between. keep in mind that the YV12 will be full range, though.
PhrostByte is offline   Reply With Quote
Old 27th July 2010, 04:04   #11  |  Link
Boogerlad
Registered User
 
Join Date: Oct 2009
Posts: 24
I added the info() to the end of the avisynth script to both the "force lossless rgb capture (may be slower)" checked and not checked videos. Both appear to be rgb32? I know it's probably because of the vfw decoder, but how did you guys figure out it was yv12?
Boogerlad is offline   Reply With Quote
Old 27th July 2010, 04:17   #12  |  Link
PhrostByte
Grand Fruitioner
 
PhrostByte's Avatar
 
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
Quote:
Originally Posted by Boogerlad View Post
I added the info() to the end of the avisynth script to both the "force lossless rgb capture (may be slower)" checked and not checked videos. Both appear to be rgb32? I know it's probably because of the vfw decoder, but how did you guys figure out it was yv12?
The official FRAPS codec always decodes to RGB, even when the file is actually the YV12 format. If you use FFVideoSource it will decode directly as full-range YV12.

I know it is YV12 because I've talked to the developer.
PhrostByte is offline   Reply With Quote
Old 27th July 2010, 04:57   #13  |  Link
Boogerlad
Registered User
 
Join Date: Oct 2009
Posts: 24
here's the script for the video with the "force lossless rgb capture (may be slower)" checked along with a screenie of info
FFVideoSource("C:\Users\Alex\Desktop\encoding\rgb.avi")
info()


here's the script for the video with the "force lossless rgb capture (may be slower)" unchecked along with a screenie of info
FFVideoSource("C:\Users\Alex\Desktop\encoding\yv12.avi")
info()

both say rgb24? Doesn't ffvideosource use ffmpeg to decode instead of the installed codecs?
Boogerlad is offline   Reply With Quote
Old 27th July 2010, 07:45   #14  |  Link
Boolsheet
Registered User
 
Join Date: Apr 2009
Location: Switzerland
Posts: 69
Quote:
Originally Posted by Boogerlad View Post
both say rgb24? Doesn't ffvideosource use ffmpeg to decode instead of the installed codecs?
Fraps uses YV12 at higher resolutions like HD.
__________________
My nightmares are horrifying, they're all interlaced!
Boolsheet is offline   Reply With Quote
Old 7th February 2012, 23:29   #15  |  Link
CoRoNe
Registered User
 
CoRoNe's Avatar
 
Join Date: Nov 2005
Posts: 645
Although my question isn't Avisynth + Fraps related in the first place, I don't think a new thread would've been necessary.

Lately, especially in the LAV Filters and FFDShow Development threads, there's been quite some discussion going on about proper Fraps support. For testing sake, I've tried to compress a Fraps video directly with the x264 video codec, without the intervention of Avisynth (which I would normally use). Obviously without additional settings the colours get screwed up, but in addition to that, instead of expecting x264's normal output colourspace, yuv420p, x264 puts out the yuvj420p colourspace, which Fraps appears to record in.

To get proper colours, I know of 2 ways to accomplish that:
- Letting Fraps itself decode the avi-file with AVISource() in Avisynth (Fraps through VFW).
- Letting FFmpegSource decode the avi-file with FFVideoSource() and ConvertToRGB(matrix="PC.709") in Avisynth. Examining the picture closely shows you this is the equivalent of the FFDShow Video Decoder with forced RGB32 output, "High quality YV12 to RGB32 conversion", "ITU-R BT.709" and "Full Range (0-255)".

This of course brings Avisynth in the picture and I'm trying to do without it. I tried to find x264-settings equivalent to ConvertToRGB(matrix="PC.709"), which I thought would be well represented. I've tried several variations with --input-csp, --output-csp, --input-range, as well as --colormatrix (which in the end I realized doesn't affect the video-stream directly), but I just couldn't get the desired result.

Does anyone know if x264 has the necessary settings to do this job, or is Avisynth at the moment the only way to succeed?
Again, for me this is for testing sake. I can always use Avisynth, but I'm just curious if the colour-conversion could be done without.


P.s. I'm using the Avisynth GUI AvsP and it shows me the sample video I used here has 375 frames in total. However, when I then Import() the avs-file (with only AVISource() in it) in a new file, it suddenly has 376 frames.
The same with x264: Having the avi-file as input directly, with either --demuxer ffms or --demuxer avs(!), results in 375 frames being encoded. Having the avs-file as input, results in 376 frames being encoded. Can someone explain this?

P.s.2. Although a bit off-topic, I noticed that, even though the original Fraps avi has a constant frame-rate, x264 (with the default ffms demuxer) tells me the input video-stream is vfr. --force-cfr can fix that of course, but is that normal?
__________________
My hobby website
CoRoNe is offline   Reply With Quote
Old 8th February 2012, 00:50   #16  |  Link
PhrostByte
Grand Fruitioner
 
PhrostByte's Avatar
 
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
If you have x264 with ffms2 built in, you can just use the fraps .avi directly and specify "--colormatrix bt709 --fullrange on". With this, all supporting players should show correct colors. Of course, not all players support it

As far as I know there is no way to convert colorspaces with only x264. When using Avisynth, you should use ColorMatrix rather than ConvertToRGB as it'll be faster and should retain better quality.
__________________
Lanczos4, Spline36, what!? Don't know how to pick a resizer? Take a look at my kernel visualizations.
Want a high-quality, gamma-aware resizer? Check out my ResampleHQ filter.
PhrostByte is offline   Reply With Quote
Old 8th February 2012, 11:37   #17  |  Link
aufkrawall
Registered User
 
Join Date: Dec 2011
Posts: 1,703
Quote:
Originally Posted by PhrostByte View Post
When using Avisynth, you should use ColorMatrix rather than ConvertToRGB as it'll be faster and should retain better quality.
Maybe this plug-in fixes the issue I'm describing here:
http://forum.doom9.org/showthread.php?t=164042

But it seems to work only with YV12, not YV24. With YV24 it looks this way:


Is there anything I can do about it?
Here's my script:
Code:
LoadCPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\ffms2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\colormatrix.dll")
FFVideoSource("trine.avi", colorspace="RGB32")
ConvertToYV24(matrix="Rec601")
ColorMatrix(mode="Rec.601->Rec.709")
aufkrawall is offline   Reply With Quote
Old 8th February 2012, 15:08   #18  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 319
I actually think JEEB's (?) builds would be the simplest way.
You can get them here.

Because on the only file I did encode with it, it actually encoded the audio to AAC.
And the container can easily be switched.
Bloax is offline   Reply With Quote
Old 8th February 2012, 17:18   #19  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,049
FRAPS seems to use its own custom color matrix for converting RGB to YV12 and back again. ConvertToRGB32(matrix="PC.709") does, AFAIK, not match the original colors exactly.

x264 does not, as far as I know, provide an option for setting the SWScale colormatrix flags that would force a conversion using Rec.709 coefficients and fullrange output.

Furthermore, the conversion from RGB (your video card's output buffer) to YV12 (FRAPS) and back to RGB (Avisynth) is not lossless.

Quote:
Originally Posted by CoRoNe View Post
P.s.2. Although a bit off-topic, I noticed that, even though the original Fraps avi has a constant frame-rate, x264 (with the default ffms demuxer) tells me the input video-stream is vfr. --force-cfr can fix that of course, but is that normal?
FFMS2 input is always considered VFR. CFR is strictly a special case of VFR where all frames have the same duration. FFMS2 doesn't really bother doing anything with this special case, so all input is always considered VFR. If you know and can certify that the input is 100% CFR, you can use --force-cfr.
TheFluff is offline   Reply With Quote
Old 8th February 2012, 17:27   #20  |  Link
richardpl
Registered User
 
Join Date: Jan 2012
Posts: 72
Actually latest FRAPS decoder from FFmpeg is VFR and from Libav is CFR.
richardpl 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 03:20.


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