10-29-2019, 09:22 PM
|
|
Free Member
|
|
Join Date: Dec 2016
Location: Minneapolis
Posts: 31
Thanked 10 Times in 6 Posts
|
|
Hello! I've finally got a workflow down that seems to work, but I'd like to know how it looks and if I'm missing anything significant before I start going all out with it.
My main goal is getting VHS to a final streamable format while keeping necessary intermediate files along the way.
1) Capture to lossless compressed HuffYUV avi using VirtualDub.
2a) Restoration/Editing work (if any) in VirtualDub using Avisynth and VirtualDub filters.
2b) Deinterlace with QTGMC using Avisynth and VirtualDub.
3) Encode for streaming using ffmpeg. Currently encoding video to H.264 using x264 in ffmpeg, audio to 128kbps AAC, and muxing (correct terminology?) to mp4 container. Noteworthy at this step is that I need to change the chroma subsampling from 4:2:2 to 4:2:0 in order for quicktime to play it (which is a necessary requirement for my friends and family).
So, this process gives me three files per tape I capture, which I am OK with. I separated the restoration and deinterlace steps out because I often will just deinteralce and not spend the time on restoration work unless it SERIOUSLY needs it (although I am learning lots about Avisynth still, thank you sanlyn!!) Therefore every file I work with will go through 2b) but not necessarily 2a).
Does this process miss anything significant? I am still a little unsure about step 3 if using ffmpeg command line is the best way to do it. It works well for me so far. The ffmpeg command I generally use is below:
Code:
ffmpeg -i input.avi -c:v libx264 -preset slow -crf 17 -vf format=yuv420p -c:a aac output.mp4
|
Someday, 12:01 PM
|
|
Ads / Sponsors
|
|
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
|
|
|
10-30-2019, 12:01 PM
|
|
Premium Member
|
|
Join Date: Jan 2017
Location: USA
Posts: 203
Thanked 92 Times in 66 Posts
|
|
You've definitely been reading the forum.
I haven't done H264 encoding. The two most mentioned on this forum, I recall, are Avidemux (not sure if it's version 2.5 or 2.6) for the freeware route, or MainConcept for the payware route. But if ffmpeg looks good to you and your audience, there may not be a need to change. Again, haven't done H264 yet to have any experienced opinion of my own.
One nit is that when you use QTGMC, you are forced to convert the AVI to 4:2:0 when you call ConvertToYV12 in avisynth prior to calling QTGMC. So the AVI is already in the 4:2:0 color space. I suppose if you are saving the avi in Virtualdub with HuffYuv 4:2:2 settings, that is what's causing the output to change back to that domain. But from what I've gathered from this forum, once you've gone to YV12 and called QTGMC, you might as well just save the AVI to Lagarith with 4:2:0 settings in Virtual dub, since 4:2:0 is now the colorspace you are in. The files will be smaller when saved with Lagarith. Although, maybe ffmpeg doesn't recognize Lagarith codec? If it doesn't, I see why you save it back to HuffYuv. Perhaps Avidemux would recognize Lagarith encoded avi if ffmpeg doesn't. I've used MainConcept for MPEG2, and so I can say it recognizes Lagarith AVI input.
Best of luck to you!
|
10-31-2019, 02:16 PM
|
|
Free Member
|
|
Join Date: Dec 2017
Location: Norway
Posts: 1,685
Thanked 460 Times in 394 Posts
|
|
Avidemux uses ffmpeg under the hood, so the results should be equivialent with the same settings. (Though the ffmpeg version in avidemux may be a bit older).
If you have a recent version of avisynth (2.6 or avisynth+) QTGMC supports YV16 and YUY2 (though it may be a little slower, especially when denoising) so you don't have to drop down to YV12 if you don't want to. That said there may not be much gain in quality over converting to YV12 first (particularly for PAL color) on a VHS source, due to camera resolution, internal VCR comb filtering etc.
Also, it's possible to run ffmpeg on an avisynth script directly if you don't need to do extra filtering in virtualdub.
Last thing, if you are publishing to youtube, I would recommend resizing up to 720p (can be 4:3 aspect still) otherwise youtube will convert to 640x480 29.97p or 25p (unless they've changed it recently). With 720p (or higher) the full 59.96/50 fps framerate and resolution is kept. You can use e.g nnedi3_rpow2 in avisynth (already installed if you have QTGMC up and running) for high-quality resizing, use it on the final output after all other filters.
|
10-31-2019, 02:30 PM
|
|
Free Member
|
|
Join Date: Oct 2018
Posts: 199
Thanked 33 Times in 27 Posts
|
|
Wow, I never made the connection that the YV12 conversion was a 4:2:0 sampling. I'm going to have to go back and reread that section of the AviSynth wiki.
Erich
|
10-31-2019, 04:13 PM
|
|
Premium Member
|
|
Join Date: Jan 2017
Location: USA
Posts: 203
Thanked 92 Times in 66 Posts
|
|
Quote:
Originally Posted by hodgey
If you have a recent version of avisynth (2.6 or avisynth+) QTGMC supports YV16 and YUY2 (though it may be a little slower, especially when denoising) so you don't have to drop down to YV12 if you don't want to.
|
I have been using 2.5 and an older QTGMC taken from this forum. Don't remember exactly why at the moment. Thanks for mentioning this! I was not aware of that!
|
10-31-2019, 05:14 PM
|
|
Free Member
|
|
Join Date: Dec 2016
Location: Minneapolis
Posts: 31
Thanked 10 Times in 6 Posts
|
|
Quote:
Originally Posted by keaton
You've definitely been reading the forum.
|
Ahah, oh yes. So much so my head starts spinning.
Quote:
Originally Posted by keaton
One nit is that when you use QTGMC, you are forced to convert the AVI to 4:2:0 when you call ConvertToYV12 in avisynth prior to calling QTGMC.
|
Ahhh yes I suppose that is true. That is exactly the kind of information I was looking for when I made this post, so thank you. I need to review/learn QTGMC and Avisynth a bit more thoroughly. I am indeed saving the avi in vdub with HuffYUV 4:2:2 settings, so that's the problem there. I only use HuffYUV in an attempt to keep things simple and use only one lossless compressed codec, but maybe it would be wise to start using Lagarith after avisynth work.
Quote:
Originally Posted by hodgey
Avidemux uses ffmpeg under the hood, so the results should be equivialent with the same settings. (Though the ffmpeg version in avidemux may be a bit older).
If you have a recent version of avisynth (2.6 or avisynth+) QTGMC supports YV16 and YUY2 (though it may be a little slower, especially when denoising) so you don't have to drop down to YV12 if you don't want to. That said there may not be much gain in quality over converting to YV12 first (particularly for PAL color) on a VHS source, due to camera resolution, internal VCR comb filtering etc.
Also, it's possible to run ffmpeg on an avisynth script directly if you don't need to do extra filtering in virtualdub.
Last thing, if you are publishing to youtube, I would recommend resizing up to 720p (can be 4:3 aspect still) otherwise youtube will convert to 640x480 29.97p or 25p (unless they've changed it recently). With 720p (or higher) the full 59.96/50 fps framerate and resolution is kept. You can use e.g nnedi3_rpow2 in avisynth (already installed if you have QTGMC up and running) for high-quality resizing, use it on the final output after all other filters.
|
Interesting. That is very useful information, thank you. I will look in to running ffmpeg directly in Avisynth which would be nice. Also good to know about the resizing for Youtube as I will probably need to do that at some point.
Anyone have any ideas about running/processing Avisynth headlessly? If I could just write my Avisynth script in a CLI text editor, then use some command from the command line to process it that would BE GREAT. I understand this approach is not a good idea for doing actually restoration work because you really should see what you're doing, but if I'm just gonna be doing QTGMC and then encoding to H.264 for the bulk of my captures then doing it headlessly would be incredibly helpful. I can always go back to the lossless compressed file and do more in depth Avisynth restoration work.
|
10-31-2019, 08:31 PM
|
|
Site Staff | Video
|
|
Join Date: Dec 2002
Posts: 14,242
Thanked 2,585 Times in 2,197 Posts
|
|
Quote:
Originally Posted by sevarre
Hello! I've finally got a workflow down that seems to work, but I'd like to know how it looks and if I'm missing anything significant before I start going all out with it.
My main goal is getting VHS to a final streamable format while keeping necessary intermediate files along the way.
1) Capture to lossless compressed HuffYUV avi using VirtualDub.
2a) Restoration/Editing work (if any) in VirtualDub using Avisynth and VirtualDub filters.
2b) Deinterlace with QTGMC using Avisynth and VirtualDub.
|
All fine.
Quote:
3) Encode for streaming using ffmpeg.
|
CLI is to me.
Hybrid is my tool of choice for x264 encoding. Very powerful GUI, makes not only x264 easy, but even basic/intermediate Avisynth and Vapoursynth.
Quote:
Currently encoding video to H.264 using x264 in ffmpeg, audio to 128kbps AAC,
|
128kbps for 44.1khz? For 48, 160 is better. You can hear distortion and pitchiness if you overcompress. 128 can work, 96 has major issues with some players (pops, etc).
Quote:
and muxing (correct terminology?)
|
Muxing is merging assets into a container, so yes.
Quote:
MP4 is still more universal, but MKV is better.
Quote:
Noteworthy at this step is that I need to change the chroma subsampling from 4:2:2 to 4:2:0 in order for quicktime to play it (which is a necessary requirement for my friends and family).
|
Yep, sometimes specs require losing quality.
Quote:
So, this process gives me three files per tape I capture, which I am OK with. I separated the restoration and deinterlace steps out because I often will just deinteralce and not spend the time on restoration work unless it SERIOUSLY needs it (although I am learning lots about Avisynth still, thank you sanlyn!!) Therefore every file I work with will go through 2b) but not necessarily 2a).
|
With Hybrid, you can QTGMC deinterlace + x264 encode in a single pass.
Even some mild restore. (You can actually do semi-advanced restore with Hybrid, but the preview is lacking, likes to crash. For hardcore restore, AvsPmod suggested, manual Avisynth.)
Quote:
Originally Posted by keaton
You've definitely been reading the forum.
|
With a 2016 join date, I'd hope so.
Quote:
I haven't done H264 encoding. The two most mentioned on this forum, I recall, are Avidemux (not sure if it's version 2.5 or 2.6) for the freeware route,
|
2.5 = MPEG-2
2.7 = x264 (2.6 works also, but now dated)
Quote:
Originally Posted by hodgey
Avidemux uses ffmpeg under the hood, so the results should be equivialent with the same settings.
|
The GUI really can make a big difference. Sometimes settings are hidden from you, or not addressed.
Quote:
so you don't have to drop down to YV12 if you don't want to.
|
Some filters just require YV12, no away around it (yet?).
Quote:
Also, it's possible to run ffmpeg on an avisynth script directly if you don't need to do extra filtering in virtualdub.
|
This is normally done because of preview, or because VirtualDub filters in tandem with Avisynth. But yes, otherwise correct, several ways to encode direct from Avisynth output, has been that way as far as I can remember (early 2000s).
Quote:
Originally Posted by keaton
I have been using 2.5 and an older QTGMC taken from this forum. Don't remember exactly why at the moment. Thanks for mentioning this! I was not aware of that!
|
Avisynth can get glitchy with the newer or advanced/non-official versions. You can actually install multiple versions, but that gets more complex yet. I have 2.6 MT and x64+ installed. I rarely run the MT, buggy, glitch frames happen.
Quote:
Originally Posted by sevarre
Ahah, oh yes. So much so my head starts spinning.
|
Welcome to video.
There are time when I'll read Avisynth discussions, and my eyes start to glaze over, mouth open, can feel a little drool forming. Seriously. It's essentially computer programming for video needs. It's not easy, even for more advanced users.
Quote:
I need to review/learn QTGMC and Avisynth a bit more thoroughly.
|
Tip: "faster", not "slow". Slow preset blurs, takes too long.
Quote:
I am indeed saving the avi in vdub with HuffYUV 4:2:2 settings, so that's the problem there. I only use HuffYUV in an attempt to keep things simple and use only one lossless compressed codec, but maybe it would be wise to start using Lagarith after avisynth work.
|
Yes.
|
10-31-2019, 09:11 PM
|
|
Free Member
|
|
Join Date: Dec 2017
Location: Norway
Posts: 1,685
Thanked 460 Times in 394 Posts
|
|
Quote:
Originally Posted by sevarre
Anyone have any ideas about running/processing Avisynth headlessly? If I could just write my Avisynth script in a CLI text editor, then use some command from the command line to process it that would BE GREAT.
|
You can run ffmpeg with a .avs file as input just like any other media file, just note that 64-bit ffmpeg will load 64-bit avisynth, 32-bit will load 32-bit.
E.g:
Code:
ffmpeg -i input.avs -c:v libx264 -preset slow -crf 17 -vf format=yuv420p -c:a aac output.mp4
There are some other tools on the avs wiki to pipe raw video etc for other apps (I believe avidemux has a thing bundled for loading avisynth as well), haven't personally used any of that though.
Quote:
Some filters just require YV12, no away around it (yet?).
|
Yeah many older (invaluable) filters only support YV12. Avs+ and 2.6 added YV16 color space support, but before that one had to use YUY2 for 4:2:2 which had the data laid out differently and was thus more extra work to add support for. It may be possible to work around it in some cases using creative resizing, but for VHS, Video8 etc there is hardly any difference between 4:2:0 and 4:2:2 anyhow, at least for PAL. (Though I do prefer keeping lossless intermediates in 4:2:2 if they are interlaced to avoid risking wrongly down-sampling the color.)
|
Thread Tools |
Search this Thread |
|
|
All times are GMT -5. The time now is 05:33 PM
|