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. |
6th August 2020, 17:22 | #1 | Link |
Registered User
Join Date: Sep 2017
Posts: 37
|
Encoding script AviSynth with FFmpeg
Hey guys, how are you?
I would like to know if it is possible to encode an avisynth script using FFmpeg without loss of quality with. I want at maximum quality (lossless). I don't care if the videos are going to get big in size, I appreciate the quality more. How do I do this step by step? Can I create a bat file to do this? What are the command lines to do this? How do I do this step by step? Can I create a bat file to do this? What are the command lines for doing this? If that is possible, could someone donate me a little time to teach me how to do this? I will be immensely grateful. xD Last edited by skywalker; 6th August 2020 at 17:51. |
6th August 2020, 17:26 | #2 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,733
|
Lossless is going to be bigger in size so better just use the original video track.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
6th August 2020, 18:01 | #3 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
Have you actually done any tests? I fully understand the quest for quality, but you may or may not be able to see the differences between various ways to encode a particular video, and you won't know for sure if you can see any differences until and unless you do your own tests.
First of all, you don't mention the source of your videos. Are they from a video camera? If so, they have already been massively compressed. The same statement applies to DVD, BD, streaming sources, etc. Unless you are in a studio and have the ability to capture uncompressed directly from the unaltered output of a professional video camera, your video source has already been compressed and will contain artifacts from that operation. So, it makes zero sense to take such a source and store it as uncompressed. You can use a "lossless" compression to at least make the file size smaller. It would be silly not to do this, because uncompressed not only consumes massive amounts of storage, but can be difficult to play back without hiccups. My advice is to do tests, as I've already recommended, and to A/B between the original and h.264 or h.265 at a high bitrate. ffmpeg can cut videos losslessly, and if that is all you want to do then something like this: ffmpeg -i MAH05691.MP4 -ss 00:15:29.112 -c copy -t 00:07:14.250 Action_Cam_01.mp4 (which I took from something I actually did) will work. Just substitute your own timecodes. |
6th August 2020, 18:16 | #4 | Link | |
Registered User
Join Date: Sep 2017
Posts: 37
|
Quote:
I usualy did the encoder to get the out video with MEGUI. But I wanted to make this encoder by FFmpeg using a variable bitrate rate. But I don't know how to do this for FFmpeg. I think that maybe this is better than in MeGui. |
|
6th August 2020, 18:40 | #5 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,733
|
They both probably use the same encoder, if not the same version then quite close anyway. MeGUI is just a GUI.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
6th August 2020, 18:50 | #7 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
So the video is being filtered by AviSynth, and you simply want to preserve that when encoding. What you want to do in that instance is to use a lossless format as an intermediate or archive copy, but use lossy at the distribution/viewing stage. Depending on the specs of the computer involved, it may not be able to cope with playing back a losslessly-encoded file in realtime, but you absolutely want to do all the editing or filtering in the lossless space.
The answer, of course, is this: Code:
ffmpeg -i test.avs -vcodec CODECNAME -acodec copy output.avi |
6th August 2020, 18:58 | #8 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Do you believe that your source cannot be improved at all ?
(I've spent last two weeks 'improving' a DVD series, it is tedious but I did not do it without cause). [EDIT: well 8 series]
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
6th August 2020, 19:06 | #9 | Link | |
Registered User
Join Date: Sep 2017
Posts: 37
|
Quote:
Code:
Script error: There is no function named 'FFVideoSource'. My script.avs: Unknown error occurred |
|
6th August 2020, 19:26 | #11 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
You need to make sure the script is written correctly. Most GUIs get by with a certain amount of hand-holding, obfuscating where tools are installed, or relying on copies they provide themselves in directories they have control over rather than it being available system-wide; if you're setting the GUIs aside, you've got to make sure the right plugins are installed and that the script works under a normal AviSynth+ system installation and usage first. Then you can give it to FFmpeg.
|
6th August 2020, 20:13 | #12 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
|
Exactly... Make sure you:
A) Have the latest Avisynth+ version installed: https://github.com/AviSynth/AviSynthPlus/releases B) Have the right plugins inside the "C:\Program Files\Avisynth\Plugin+" directory C) Make sure that if you're using Avisynth x64, your plugins are 64bit and your ffmpeg build is 64bit as well (same for 32bit) https://ffmpeg.zeranoe.com/builds/ D) Your environment is ok and your script is working AVSMeter is your friend for checking the environment: https://forum.doom9.org/showthread.php?t=173259 AVSPmod is your friend for writing and testing scripts: https://forum.doom9.org/showthread.php?t=175823 Side note: unlike some other fella, I'm totally against GUIs like MeGUI. Although it's true that they use the very same things you would be using with a BAT like Avisynth, x264, x265, ffmpeg etc, they choose the options for you most of the time and you have little to no idea about what settings it's using. In particular, MeGUI has been using some rather controversial settings in x264 for years, while with a BAT you have total control over what's going on and what settings to use. So... I understand that it's gonna be a big step for you to switch from a GUI based approach to a command line one, but believe me, it's totally worth it and you'll never look back ever again. |
6th August 2020, 21:19 | #13 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
I don't agree on your sentiment against GUIs. Bat is one of the worst command languages that ever existed and one of the worst products MS ever created, so it's not particular good advice either and understanding PowerShell on a level that it's useful is actually hard, even for an experienced programmer, if it would be so easy there would be a lot more people here using console related tools, like for instance mpv.
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
6th August 2020, 22:10 | #14 | Link | ||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
|
Quote:
Quote:
Anyway, I know that you're the author of Staxrip which has a UI. I've never used it, so I can't say anything about it, but since people find it useful, it's nice that you develop and maintain it, so well done . You see, I'm not against each and every GUI, in the sense that it's not like I would never use a GUI, "period", but the reason why I try to avoid them is 'cause most of the time devs just don't let users know what things are going on under the hood and take decisions for them, however if a GUI allows the user to choose everything and it's transparent about what is doing, then I have no problem about that and I'm actually in favor of it in that case. I'll show you an example: take AVID Media Composer. If you use it and apply a resizing filter for instance, you can easily draw and move x and y axes to decide how much you want to "zoom" in the image and then you can render your effect and export. Too bad that the "zoom" is actually a crop and upscale, so how does it do it? Which resizing kernel does it use? And what about interlaced contents? Another example would be 10bit contents "imported" in an 8bit timeline. What is it gonna do? Is it gonna truncate everything to get 8bit? Is it gonna apply some sort of dithering? And what about clips with a different framerate? Is it gonna use blending? Is it gonna duplicate frames? And how about denoise filters? How do they work? Are they both spatial and temporal? Which blocks/macroblock size are gonna be analysed? And how about the frames in the temporal denoise? And which Transform do they use? DFT? And at which bitdepth? And so on and on and on... I could go on forever... There are countless examples where GUIs don't really allow you to tweak parameters or know what is going on under the hood, which is why I love Avisynth and the command line and I hate closed source UI, 'cause I know EXACTLY what is going on in the command line while I have little to no clue about closed source UI... Last edited by FranceBB; 6th August 2020 at 22:17. |
||
7th August 2020, 09:51 | #15 | Link | |||
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
Quote:
Quote:
Quote:
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists Last edited by stax76; 7th August 2020 at 10:16. |
|||
7th August 2020, 11:31 | #16 | Link | |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
|
Quote:
I'm gonna repeat it once again: I'm generally against GUIs who don't allow people to choose settings and take decisions for them, unlike the command line where you can choose everything. AVID Media Composer is an example. I even said that IF and only IF a GUI is transparent about what it's doing, then I have no problem with that and I also said that I know that you're an author of a GUI and that you might find yourself "attacked" by my statement, but that it wasn't referred to you specifically 'cause I never used Staxrip, so I can't comment about it (and I'm not planning to do so) but since users are using it you're absolutely right to maintain it and develop it so that it can help people out. You're helping the community and that's great. Is it clear now? I mean, don't get me wrong, I didn't really want to argue or upset you or make you angry, I mean, it wasn't my intention, but on the other hand, as I said before, I've seen many user interfaces that just don't allow users to choose things to make their life easier and I don't like that, that's why I don't like GUIs. Again, there are exceptions, sure, and if your program is one of the exceptions that allows users to do everything then great, I trust your words, but that's the way I think. By the way, why are we even arguing about this? We're probably derailing the topic from its own original purpose. Let's call it off, shall we. Last edited by FranceBB; 7th August 2020 at 11:40. |
|
7th August 2020, 13:34 | #17 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
It's not just this thread, you say it all the time. I'm also totally against many things (like totalitarianism) but I can keep it for me if it doesn't harm me and I'm not particularly well-informed and experienced about a topic.
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
7th August 2020, 14:37 | #18 | Link | |
Useful n00b
Join Date: Jul 2014
Posts: 1,667
|
Quote:
You'd have to be out of your mind or a zealot to prefer using DGDemux directly (instead of via the GUI) unless you are doing batch operations. I also think you make a logical misstep in going from "GUI A is not transparent" to "I hate GUIs." IIANM staxrip also allows the command lines to be viewed. Last edited by videoh; 7th August 2020 at 14:49. |
|
|
|