VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Page 2 of 4
FirstFirst 1 2 3 4 LastLast
Results 31 to 60 of 111
Thread
  1. Originally Posted by jagabo View Post

    I forgot to mention that. It doesn't. Which will be a problem with some videos. If you use ffmpeg to remux the audio from the original VOB will it account for any audio delay? If so, the script can be modified to do that.

    I think so, the audio +/- offset will be taken into account from the VOB as-is

    But there can be a discrepancy between what DGDecode "sees" and what ffmpeg "sees" in terms of framecount. how it handles leading b's for example, so there is potential for some issues


    Is there a way to read or parse that value in the filename? Some programs do that e.g. megui automatically configures the +/- delay value from the demuxed audio name

    Someone must have done batches similar to this before?
    Quote Quote  
  2. I was looking for a sample with a large AV delay so we can see if works or if problems arise by taking the audio from a vob; but other issues might come up too. For example, Jeff Foxworthy is actually interlaced content so a different batch would be needed for that series assuming all seasons/episodes were done the same way
    Quote Quote  
  3. And there can be multiple audio tracks. Multiple video tracks can be multiplexed (I have some cartoons that have a second of the regular cartoon, a second of the pencil storyboards, etc., these have to be remuxed with VOB2MPG in IFO mode to separate the two streams). There are lots of pitfalls to automated conversion like this. Oh, I also forgot to include a resize or DAR/SAR values to the ffmpeg encoding.
    Quote Quote  
  4. Originally Posted by jagabo View Post
    And there can be multiple audio tracks. Multiple video tracks can be multiplexed (I have some cartoons that have a second of the regular cartoon, a second of the pencil storyboards, etc., these have to be remuxed with VOB2MPG in IFO mode to separate the two streams). There are lots of pitfalls to automated conversion like this. Oh, I also forgot to include a resize or DAR/SAR values to the ffmpeg encoding.
    Yes, and AR differences. Not all are 4:3 , for example Bookies in that group was not. So single batch would have to be quite complex to take into account all these potential issues.
    Quote Quote  
  5. FWIW, here's an example where the AC3 audio is copied from the VOB file instead of the demuxed AC3 audio from Dgindex:

    Code:
    for %%A in ("*.VOB") do (
        AVS_Mpeg2Source "%%A"
        "g:\program files\ffmpeg\bin\ffmpeg.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "NewlyConvertedFilesDenoise\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
        del "%%~nA.d2v"
        del "%%~nA.d2v.bad"
        del "%%~nA.fix.txt"
    )
    The first audio track is copied. sar is set to 8:9 too.

    And here it is with the functionality of AVS_Mpeg2Source.bat built in:

    Code:
    for %%A in ("*.VOB") do (
        "G:\Program Files\DgIndex\DGIndex.exe" -i "%%~A" -o "%%~dpnA" -fo 0 -om 2 -exit
        echo Mpeg2Source("%%~dpnA.d2v", CPU2="ooooxx", Info=3^) > "%%~A.avs"
        echo TFM(d2v="%%~dpnA.d2v"^) >> "%%~A.avs"
        echo TDecimate(^) >> "%%~A.avs"
        "g:\program files\ffmpeg\bin\ffmpeg.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "NewlyConvertedFilesDenoise\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
        del "%%~nA.d2v"
        del "%%~nA.d2v.bad"
        del "%%~nA.fix.txt"
    )
    So this last batch file no longer need AVS_Mpeg2Source.bat.
    Last edited by jagabo; 28th Apr 2018 at 19:41.
    Quote Quote  
  6. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Before I forget, everything below applies to .VOB (DVD) fiiles. But is there also a way to apply this to .mp4, .mkv, .avi, etc flies?



    Originally Posted by jagabo View Post
    You would combine poisondeathray's ffmpeg/for loop with my batch builder to process each mkv file.

    Not quite sure how to "combine" them. Is this how? (Most likely not because it really didn't do anything)

    Code:
    if not exist Fridaytest md Fridaytest
    "C:\Program Files (x86)\AMVpack\DGMPGDec\DGIndex.exe" -i "%~1" -o "%~dpn1" -fo 0 -om 2 -exit
    echo Mpeg2Source("%~dpn1.d2v", CPU2="ooooxx", Info=3) >> "%~1.avs"
    echo TFM(d2v="%~d1%~p1%~n1.d2v") >> "%~1.avs"
    echo TDecimate() >> "%~1.avs"
    for %%a in ("*.avs") do ffmpeg -i "%%a" -y -c:v libx264 -preset veryslow -tune film -crf 24 -vf hqdn3d -c:a ac3 -ac 2 -b:a 128k "Fridaytest\%%~na.mp4"
    pause

    I also tried this way to "combine" them, which also didn't do anything.
    Code:
    if not exist Fridaytest md Fridaytest
    for %%a in ("*.avs") do ffmpeg -i "%%a" -y -c:v libx264 -preset veryslow -tune film -crf 24 -vf hqdn3d -c:a ac3 -ac 2 -b:a 128k "Fridaytest\%%~na.mp4"
    "C:\Program Files (x86)\AMVpack\DGMPGDec\DGIndex.exe" -i "%~1" -o "%~dpn1" -fo 0 -om 2 -exit
    echo Mpeg2Source("%~dpn1.d2v", CPU2="ooooxx", Info=3) >> "%~1.avs"
    echo TFM(d2v="%~d1%~p1%~n1.d2v") >> "%~1.avs"
    echo TDecimate() >> "%~1.avs"
    pause
    Then I tried this way to "combine" them, and again nothing.
    Code:
    for %%a in ("*.vob") do (
    "C:\Program Files (x86)\AMVpack\DGMPGDec\DGIndex.exe" -i "%~1" -o "%~dpn1" -fo 0 -om 2 -exit
    echo Mpeg2Source("%~dpn1.d2v", CPU2="ooooxx", Info=3) >> "%~1.avs"
    echo TFM(d2v="%~d1%~p1%~n1.d2v") >> "%~1.avs"
    echo TDecimate() >> "%~1.avs"
    )



    (A) The quote just below is the "jagaboBLUEPRINTsendto" file that you wrote out earlier, and I definitely like it. And the quote further below is from poisondeathray. With your "jagaboBLUEPRINTsendto" file, I can and would have to individually send each .vob file to it (right click on .vob file and "sendto", one after another, until TV episode 200, or 800 episodes for various

    I'll refer to your code below the "jagaboBLUEPRINTsendto" file ... I know you said to combined them (and I tried up above) but I'm not sure how to so that I can either:
    (A) Send the entire folder (containing 800 vob) to "jagaboBLUEPRINTsendto"
    (B) or highlight all 800 vob files, and drag & drop them directly onto "jagaboBLUEPRINTsendto" to generate 800 .avs file. And yes, I want the same .avs setting template to apply to all 800 video files). Is there some type of code thingy like &&*%%entirefoldercontentvideofiles/will/be/converted%% to 800 individual .avs file, d2v files, text files, ac3 fiiles, etc.?



    Originally Posted by jagabo View Post
    If it helps, I have a batch file that builds an AviSynth script given a filename:

    Code:
    "G:\Program Files\DgIndex\DGIndex.exe" -i "%~1" -o "%~dpn1" -fo 0 -om 2 -exit
    echo Mpeg2Source("%~dpn1.d2v", CPU2="ooooxx", Info=3) >> "%~1.avs"
    echo TFM(d2v="%~d1%~p1%~n1.d2v") >> "%~1.avs"
    echo TDecimate() >> "%~1.avs"
    You have to change the path on the first line to where DgIndex is located on your computer. This batch file is in my SendTo folder so I can right click on a video then select Send To -> AVS_Mpeg2Source.bat. Or you can drag/drop a file onto it. You should be able to see how to add other options to the resulting script if necessary.

    DgIndex doesn't work well for MPEG 2 video in MKV files. If your sources are MKV (from MakeMKV?) it may be necessary to demux the video first.
    Originally Posted by poisondeathray View Post
    Each script reference a single video. So you would need a script for each episode. There are various avs batch scripters.

    It would be *.avs as the input, not *.mkv. Because the avs is the actual direct input. You would need to include audio in the avs since you're encoding audio. I would use AAC instead of AC3 at 128kbps
    Code:
    for %%a in ("*.avs") do ffmpeg -i "%%a" -re -y -c:v libx264 -preset veryslow -tune film -crf 24 -vf hqdn3d -c:a ac3 -ac 2 -b:a 128k "NewlyConvertedFilesDenoise\%%~na.mp4"
    
    pause



    I normally use DVDshrink so I get the standard .VOB file. When using Makemkv, ripping the DVD comes out in mkv format. Maybe I could simply convert the mkv to .vob format.


    (B) To add other filters and treatment to the "jagaboBLUEPRINTsendto" file, I think I did this correct because I was able to load the .avs file into AVSPmod and AVSPmod recognized it when I hit F5 and the video was playing (but there wasn't any sound).

    Code:
    "C:\Program Files (x86)\AMVpack\DGMPGDec\DGIndex.exe" -i "%~1" -o "%~dpn1" -fo 0 -om 2 -exit
    echo Mpeg2Source("%~dpn1.d2v", CPU2="ooooxx", Info=3) >> "%~1.avs"
    echo TFM(d2v="%~d1%~p1%~n1.d2v") >> "%~1.avs"
    echo TDecimate() >> "%~1.avs"
    echo Hysteria(strength=20, usemask=true, lowthresh=6, highthresh=20, luma_cap=191) >> "%~1.avs"
    So anytime I want to add another filter or some, I would just add "echo" to the beginning of line and "%~1.avs" to the end of the line.





    When it comes to merging the audio and video together, this is the code that you wrote. This is perfect. The audio and video seems to sync well in the test runs that I did.


    Code:
    if not exist jagabotest md jagabotest
    for %%a in ("*.VOB") do (
        AVS_Mpeg2Source "%%a"
        del audiofile.ac3
        ren "%%~na*.ac3" audiofile.ac3
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%a.AVS" -i audiofile.ac3 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d "jagabotest\%%~na.mp4"
        del audiofile.AC3
        del "%%a.AVS"
        del "%%~na.d2v"
        del "%%~na.d2v.bad"
        del "%%~na.fix.txt"
    )
    pause


    Last but not least for this, all of the above only applies to .VOB files. Is there a way to modify the script to work .mp4, .mkv, .avi files?
    Last edited by strawberryshortcake; 28th Apr 2018 at 19:52.
    Quote Quote  
  7. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    FWIW, here's an example where the AC3 audio is copied from the VOB file instead of the demuxed AC3 audio from Dgindex:

    Code:
    for %%A in ("*.VOB") do (
        AVS_Mpeg2Source "%%A"
        "g:\program files\ffmpeg\bin\ffmpeg.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "NewlyConvertedFilesDenoise\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
        del "%%~nA.d2v"
        del "%%~nA.d2v.bad"
        del "%%~nA.fix.txt"
    )
    The first audio track is copied. sar is set to 8:9 too.

    And here it is with the functionality of AVS_Mpeg2Source.bat built in:

    Code:
    for %%A in ("*.VOB") do (
        "G:\Program Files\DgIndex\DGIndex.exe" -i "%%~A" -o "%%~dpnA" -fo 0 -om 2 -exit
        echo Mpeg2Source("%%~dpnA.d2v", CPU2="ooooxx", Info=3^) > "%%~A.avs"
        echo TFM(d2v="%%~dpnA.d2v"^) >> "%%~A.avs"
        echo TDecimate(^) >> "%%~A.avs"
        "g:\program files\ffmpeg\bin\ffmpeg.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "NewlyConvertedFilesDenoise\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
        del "%%~nA.d2v"
        del "%%~nA.d2v.bad"
        del "%%~nA.fix.txt"
    )
    So this last batch file no longer need AVS_Mpeg2Source.bat.
    I'll test out these and see what they do right now.
    Quote Quote  
  8. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Jagabo. Fantastic work. Absolutely Thank You. Is there something like this for .mp4, .mkv, etc.?

    The second code that you wrote for the time being is working like a champ. That's exactly what I wanted for .VOBs. And to add any filter I simply had to add "echo" to the beginning line and ^ before the closing parenthesis and "%%~A.avs" to the end of the line.

    Now I just have to figure out one of these automated processes for .mp4, .mkv, .avi, using Avisynth, or do you already have something working in place?

    Also, how do I interpret the syntax
    %%~dpnA.d2V
    CPU2="ooooxx"
    Info=3^
    %%~A.avs
    etc. etc


    Code:
    if not exist GREENFLOWER md GREENFLOWER
    for %%A in ("*.VOB") do (
        "C:\Program Files (x86)\AMVpack\DGMPGDec\DGIndex.exe" -i "%%~A" -o "%%~dpnA" -fo 0 -om 2 -exit
        echo Mpeg2Source("%%~dpnA.d2v", CPU2="ooooxx", Info=3^) > "%%~A.avs"
        echo TFM(d2v="%%~dpnA.d2v"^) >> "%%~A.avs"
        echo TDecimate(^) >> "%%~A.avs"
        echo Hysteria(strength=20, usemask=true, lowthresh=6, highthresh=20, luma_cap=191, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "GREENFLOWER\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
        del "%%~nA.d2v"
        del "%%~nA.d2v.bad"
        del "%%~nA.fix.txt"
    )
    pause
    ================================================== ===========
    if not exist GREENFLOWER md GREENFLOWER
    for %%A in ("*.VOB") do (
    "C:\Program Files (x86)\AMVpack\DGMPGDec\DGIndex.exe" -i "%%~A" -o "%%~dpnA" -fo 0 -om 2 -exit
    echo Mpeg2Source("%%~dpnA.d2v", CPU2="ooooxx", Info=3^) > "%%~A.avs"
    echo TFM(d2v="%%~dpnA.d2v"^) >> "%%~A.avs"
    echo TDecimate(^) >> "%%~A.avs"
    echo Hysteria(strength=20, usemask=true, lowthresh=6, highthresh=20, luma_cap=191, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
    "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "GREENFLOWER\%%~nA.mp4"
    del "%%~nA*.AC3"
    del "%%A.AVS"
    del "%%~nA.d2v"
    del "%%~nA.d2v.bad"
    del "%%~nA.fix.txt"
    )
    pause

    ================================================== ===========


    Place the batch .bat file into the folder with all the .VOB files, double click and it starts to work automatically. DGIndex prompts up, once that completes it closes by itself, and starts the CMD prompt commands. Once video1.vob completes, it automatically brings up DGIndex to work on the second file, video2.vob, and rinse and repeat. Basically set it and forget. I can leave the house and not have to worry. Perfect.


    Unfortunately the first code didn't really do anything. I also copied and pasted as much of it down below

    Click image for larger version

Name:	Jagabo Script M.png
Views:	17
Size:	125.3 KB
ID:	45447






    Originally Posted by jagabo View Post
    FWIW, here's an example where the AC3 audio is copied from the VOB file instead of the demuxed AC3 audio from Dgindex:

    Code:
    for %%A in ("*.VOB") do (
        AVS_Mpeg2Source "%%A"
        "g:\program files\ffmpeg\bin\ffmpeg.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "NewlyConvertedFilesDenoise\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
        del "%%~nA.d2v"
        del "%%~nA.d2v.bad"
        del "%%~nA.fix.txt"
    )
    The first audio track is copied. sar is set to 8:9 too.

    And here it is with the functionality of AVS_Mpeg2Source.bat built in:

    Code:
    for %%A in ("*.VOB") do (
        "G:\Program Files\DgIndex\DGIndex.exe" -i "%%~A" -o "%%~dpnA" -fo 0 -om 2 -exit
        echo Mpeg2Source("%%~dpnA.d2v", CPU2="ooooxx", Info=3^) > "%%~A.avs"
        echo TFM(d2v="%%~dpnA.d2v"^) >> "%%~A.avs"
        echo TDecimate(^) >> "%%~A.avs"
        "g:\program files\ffmpeg\bin\ffmpeg.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "NewlyConvertedFilesDenoise\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
        del "%%~nA.d2v"
        del "%%~nA.d2v.bad"
        del "%%~nA.fix.txt"
    )
    So this last batch file no longer need AVS_Mpeg2Source.bat.






    Code:
     del "%~nA.fix.txt"
    )
    
    T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Jagabo Batch Code
     Test>(
    AVS_Mpeg2Source "Hey Arnold Ep1 (S1D1).VOB"
     "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "Hey Arnold Ep1 (S1D1).
    VOB.AVS" -i "Hey Arnold Ep1 (S1D1).VOB" -map 0:0 -map 1:a:0 -y -c:v libx264 -pre
    set veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "DARKREDPURP
    LE\Hey Arnold Ep1 (S1D1).mp4"
     del "Hey Arnold Ep1 (S1D1)*.AC3"
     del "Hey Arnold Ep1 (S1D1).VOB.AVS"
     del "Hey Arnold Ep1 (S1D1).d2v"
     del "Hey Arnold Ep1 (S1D1).d2v.bad"
     del "Hey Arnold Ep1 (S1D1).fix.txt"
    )
    'AVS_Mpeg2Source' is not recognized as an internal or external command,
    operable program or batch file.
    ffmpeg version N-90810-g153e920892 Copyright (c) 2000-2018 the FFmpeg developers
    
      built with gcc 7.3.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
    nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
    ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
    libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
    le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
    bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
    able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
    libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
    e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl
    e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab
    le-dxva2 --enable-avisynth
      libavutil      56. 15.100 / 56. 15.100
      libavcodec     58. 19.100 / 58. 19.100
      libavformat    58. 13.100 / 58. 13.100
      libavdevice    58.  4.100 / 58.  4.100
      libavfilter     7. 19.100 /  7. 19.100
      libswscale      5.  2.100 /  5.  2.100
      libswresample   3.  2.100 /  3.  2.100
      libpostproc    55.  2.100 / 55.  2.100
    Hey Arnold Ep1 (S1D1).VOB.AVS: No such file or directory
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep1 (S1D1)*.AC3
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep1 (S1D1).VOB.AVS
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep1 (S1D1).d2v
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep1 (S1D1).d2v.bad
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep1 (S1D1).fix.txt
    
    T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Jagabo Batch Code
     Test>(
    AVS_Mpeg2Source "Hey Arnold Ep2 (S1D1).VOB"
     "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "Hey Arnold Ep2 (S1D1).
    VOB.AVS" -i "Hey Arnold Ep2 (S1D1).VOB" -map 0:0 -map 1:a:0 -y -c:v libx264 -pre
    set veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "DARKREDPURP
    LE\Hey Arnold Ep2 (S1D1).mp4"
     del "Hey Arnold Ep2 (S1D1)*.AC3"
     del "Hey Arnold Ep2 (S1D1).VOB.AVS"
     del "Hey Arnold Ep2 (S1D1).d2v"
     del "Hey Arnold Ep2 (S1D1).d2v.bad"
     del "Hey Arnold Ep2 (S1D1).fix.txt"
    )
    'AVS_Mpeg2Source' is not recognized as an internal or external command,
    operable program or batch file.
    ffmpeg version N-90810-g153e920892 Copyright (c) 2000-2018 the FFmpeg developers
    
      built with gcc 7.3.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
    nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
    ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
    libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
    le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
    bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
    able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
    libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
    e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl
    e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab
    le-dxva2 --enable-avisynth
      libavutil      56. 15.100 / 56. 15.100
      libavcodec     58. 19.100 / 58. 19.100
      libavformat    58. 13.100 / 58. 13.100
      libavdevice    58.  4.100 / 58.  4.100
      libavfilter     7. 19.100 /  7. 19.100
      libswscale      5.  2.100 /  5.  2.100
      libswresample   3.  2.100 /  3.  2.100
      libpostproc    55.  2.100 / 55.  2.100
    Hey Arnold Ep2 (S1D1).VOB.AVS: No such file or directory
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep2 (S1D1)*.AC3
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep2 (S1D1).VOB.AVS
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep2 (S1D1).d2v
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep2 (S1D1).d2v.bad
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep2 (S1D1).fix.txt
    
    T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Jagabo Batch Code
     Test>(
    AVS_Mpeg2Source "Hey Arnold Ep3 (S1D1).VOB"
     "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "Hey Arnold Ep3 (S1D1).
    VOB.AVS" -i "Hey Arnold Ep3 (S1D1).VOB" -map 0:0 -map 1:a:0 -y -c:v libx264 -pre
    set veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "DARKREDPURP
    LE\Hey Arnold Ep3 (S1D1).mp4"
     del "Hey Arnold Ep3 (S1D1)*.AC3"
     del "Hey Arnold Ep3 (S1D1).VOB.AVS"
     del "Hey Arnold Ep3 (S1D1).d2v"
     del "Hey Arnold Ep3 (S1D1).d2v.bad"
     del "Hey Arnold Ep3 (S1D1).fix.txt"
    )
    'AVS_Mpeg2Source' is not recognized as an internal or external command,
    operable program or batch file.?
    ffmpeg version N-90810-g153e920892 Copyright (c) 2000-2018 the FFmpeg developers
    
      built with gcc 7.3.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
    nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
    ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
    libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
    le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
    bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
    able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
    libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
    e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl
    e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab
    le-dxva2 --enable-avisynth
      libavutil      56. 15.100 / 56. 15.100
      libavcodec     58. 19.100 / 58. 19.100
      libavformat    58. 13.100 / 58. 13.100
      libavdevice    58.  4.100 / 58.  4.100
      libavfilter     7. 19.100 /  7. 19.100
      libswscale      5.  2.100 /  5.  2.100
      libswresample   3.  2.100 /  3.  2.100
      libpostproc    55.  2.100 / 55.  2.100
    Hey Arnold Ep3 (S1D1).VOB.AVS: No such file or directory
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep3 (S1D1)*.AC3
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep3 (S1D1).VOB.AVS
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep3 (S1D1).d2v
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep3 (S1D1).d2v.bad
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep3 (S1D1).fix.txt
    
    T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Jagabo Batch Code
     Test>(
    AVS_Mpeg2Source "Hey Arnold Ep4 (S1D1).VOB"
     "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "Hey Arnold Ep4 (S1D1).
    VOB.AVS" -i "Hey Arnold Ep4 (S1D1).VOB" -map 0:0 -map 1:a:0 -y -c:v libx264 -pre
    set veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "DARKREDPURP
    LE\Hey Arnold Ep4 (S1D1).mp4"
     del "Hey Arnold Ep4 (S1D1)*.AC3"
     del "Hey Arnold Ep4 (S1D1).VOB.AVS"
     del "Hey Arnold Ep4 (S1D1).d2v"
     del "Hey Arnold Ep4 (S1D1).d2v.bad"
     del "Hey Arnold Ep4 (S1D1).fix.txt"
    )
    'AVS_Mpeg2Source' is not recognized as an internal or external command,
    operable program or batch file.
    ffmpeg version N-90810-g153e920892 Copyright (c) 2000-2018 the FFmpeg developers
    
      built with gcc 7.3.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
    nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
    ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
    libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
    le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
    bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
    able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
    libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
    e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl
    e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab
    le-dxva2 --enable-avisynth
      libavutil      56. 15.100 / 56. 15.100
      libavcodec     58. 19.100 / 58. 19.100
      libavformat    58. 13.100 / 58. 13.100
      libavdevice    58.  4.100 / 58.  4.100
      libavfilter     7. 19.100 /  7. 19.100
      libswscale      5.  2.100 /  5.  2.100
      libswresample   3.  2.100 /  3.  2.100
      libpostproc    55.  2.100 / 55.  2.100
    Hey Arnold Ep4 (S1D1).VOB.AVS: No such file or directory
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep4 (S1D1)*.AC3
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep4 (S1D1).VOB.AVS
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep4 (S1D1).d2v
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep4 (S1D1).d2v.bad
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep4 (S1D1).fix.txt
    
    T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Jagabo Batch Code
     Test>(
    AVS_Mpeg2Source "Hey Arnold Ep5 (S1D1).VOB"
     "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "Hey Arnold Ep5 (S1D1).
    VOB.AVS" -i "Hey Arnold Ep5 (S1D1).VOB" -map 0:0 -map 1:a:0 -y -c:v libx264 -pre
    set veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "DARKREDPURP
    LE\Hey Arnold Ep5 (S1D1).mp4"
     del "Hey Arnold Ep5 (S1D1)*.AC3"
     del "Hey Arnold Ep5 (S1D1).VOB.AVS"
     del "Hey Arnold Ep5 (S1D1).d2v"
     del "Hey Arnold Ep5 (S1D1).d2v.bad"
     del "Hey Arnold Ep5 (S1D1).fix.txt"
    )
    'AVS_Mpeg2Source' is not recognized as an internal or external command,
    operable program or batch file.
    ffmpeg version N-90810-g153e920892 Copyright (c) 2000-2018 the FFmpeg developers
    
      built with gcc 7.3.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
    nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
    ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
    libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
    le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
    bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
    able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
    libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
    e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl
    e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab
    le-dxva2 --enable-avisynth
      libavutil      56. 15.100 / 56. 15.100
      libavcodec     58. 19.100 / 58. 19.100
      libavformat    58. 13.100 / 58. 13.100
      libavdevice    58.  4.100 / 58.  4.100
      libavfilter     7. 19.100 /  7. 19.100
      libswscale      5.  2.100 /  5.  2.100
      libswresample   3.  2.100 /  3.  2.100
      libpostproc    55.  2.100 / 55.  2.100
    Hey Arnold Ep5 (S1D1).VOB.AVS: No such file or directory
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep5 (S1D1)*.AC3
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep5 (S1D1).VOB.AVS
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep5 (S1D1).d2v
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep5 (S1D1).d2v.bad
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep5 (S1D1).fix.txt
    
    T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Jagabo Batch Code
     Test>(
    AVS_Mpeg2Source "Hey Arnold Ep6 (S1D2).VOB"
     "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "Hey Arnold Ep6 (S1D2).
    VOB.AVS" -i "Hey Arnold Ep6 (S1D2).VOB" -map 0:0 -map 1:a:0 -y -c:v libx264 -pre
    set veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "DARKREDPURP
    LE\Hey Arnold Ep6 (S1D2).mp4"
     del "Hey Arnold Ep6 (S1D2)*.AC3"
     del "Hey Arnold Ep6 (S1D2).VOB.AVS"
     del "Hey Arnold Ep6 (S1D2).d2v"
     del "Hey Arnold Ep6 (S1D2).d2v.bad"
     del "Hey Arnold Ep6 (S1D2).fix.txt"
    )
    'AVS_Mpeg2Source' is not recognized as an internal or external command,
    operable program or batch file.
    ffmpeg version N-90810-g153e920892 Copyright (c) 2000-2018 the FFmpeg developers
    
      built with gcc 7.3.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
    nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
    ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
    libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
    le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
    bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
    able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
    libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
    e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl
    e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab
    le-dxva2 --enable-avisynth
      libavutil      56. 15.100 / 56. 15.100
      libavcodec     58. 19.100 / 58. 19.100
      libavformat    58. 13.100 / 58. 13.100
      libavdevice    58.  4.100 / 58.  4.100
      libavfilter     7. 19.100 /  7. 19.100
      libswscale      5.  2.100 /  5.  2.100
      libswresample   3.  2.100 /  3.  2.100
      libpostproc    55.  2.100 / 55.  2.100
    Hey Arnold Ep6 (S1D2).VOB.AVS: No such file or directory
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep6 (S1D2)*.AC3
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep6 (S1D2).VOB.AVS
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep6 (S1D2).d2v
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep6 (S1D2).d2v.bad
    Could Not Find T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Ja
    gabo Batch Code Test\Hey Arnold Ep6 (S1D2).fix.txt
    
    T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Jagabo Batch Code
     Test>pause
    Press any key to continue . . .







    EDIT: Also there is a text file (1kb) left behind that shows the information of the video. Is this suppose to be the specification of the .vob file BEFORE anything gets process? Because only looking at the FPS, the text shows 29.97 while the converted file show 23.976



    TEXT file (1kb)
    Code:
    Stream Type: MPEG2 Program
    Profile: main@main
    Frame Size: 720x480
    Display Size: [not specified]
    Aspect Ratio: 4:3 [2]
    Frame Rate: 29.970030 fps
    Video Type: NTSC
    Frame Type: Interlaced
    Coding Type: P
    Colorimetry: BT.470-2 B,G*
    Frame Structure: Frame
    Field Order: 
    Coded Number: 3828
    Playback Number: 2
    Frame Repeats: 0
    Field Repeats: 0
    VOB ID: 1
    Cell ID: 2
    Bitrate: 
    Bitrate (Avg): 
    Bitrate (Max): 
    Audio Stream: 80: AC3 2/0 192
    Timestamp: 0:02:07
    Elapsed: 0:00:02
    Remain: FINISH
    FPS: 
    Info:
    MEDIAINFO on .vob original file
    Code:
    General
    Complete name                            : T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Jagabo Batch Code Test\Hey Arnold Ep1 (S1D1).VOB
    Format                                   : MPEG-PS
    File size                                : 88.4 MiB
    Duration                                 : 2 min 7 s
    Overall bit rate mode                    : Constant
    Overall bit rate                         : 5 804 kb/s
    
    Video
    ID                                       : 224 (0xE0)
    Format                                   : MPEG Video
    Format version                           : Version 2
    Format profile                           : Main@Main
    Format settings                          : CustomMatrix / BVOP
    Format settings, BVOP                    : Yes
    Format settings, Matrix                  : Custom
    Format settings, GOP                     : M=3, N=15
    Format settings, picture structure       : Frame
    Duration                                 : 2 min 7 s
    Bit rate mode                            : Constant
    Bit rate                                 : 5 500 kb/s
    Width                                    : 720 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 4:3
    Frame rate                               : 29.970 (30000/1001) FPS
    Standard                                 : NTSC
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Interlaced
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.531
    Time code of first frame                 : 00:00:00:00
    Time code source                         : Group of pictures header
    Stream size                              : 83.7 MiB (95%)
    Color primaries                          : BT.601 NTSC
    Transfer characteristics                 : BT.601
    Matrix coefficients                      : BT.601
    
    Audio
    ID                                       : 189 (0xBD)-128 (0x80)
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Muxing mode                              : DVD-Video
    Duration                                 : 2 min 7 s
    Bit rate mode                            : Constant
    Bit rate                                 : 192 kb/s
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Stream size                              : 2.92 MiB (3%)
    Service kind                             : Complete Main
    
    Menu

    MEDIAINFO on .mp4 video after using jagabo's code batch .bat file.
    Code:
    General
    Complete name                            : T:\(M) DVD Hey Arnold\AVS Test (vob file) - original files\New Jagabo Batch Code Test\GREENFLOWER\Hey Arnold Ep1 (S1D1).mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom (isom/iso2/avc1/mp41)
    File size                                : 35.5 MiB
    Duration                                 : 2 min 7 s
    Overall bit rate                         : 2 334 kb/s
    Writing application                      : Lavf58.13.100
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3
    Format settings                          : CABAC / 4 Ref Frames
    Format settings, CABAC                   : Yes
    Format settings, RefFrames               : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 2 min 7 s
    Bit rate                                 : 2 136 kb/s
    Width                                    : 720 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 4:3
    Frame rate mode                          : Constant
    Frame rate                               : 23.976 (24000/1001) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.258
    Stream size                              : 32.5 MiB (92%)
    Writing library                          : x264 core 155 r2901 7d0ff22
    Encoding settings                        : cabac=1 / ref=1 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=hex / subme=2 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=6 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=10 / rc=crf / mbtree=1 / crf=24.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    
    Audio
    ID                                       : 2
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Codec ID                                 : ac-3
    Duration                                 : 2 min 7 s
    Bit rate mode                            : Constant
    Bit rate                                 : 192 kb/s
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Stream size                              : 2.92 MiB (8%)
    Service kind                             : Complete Main
    Default                                  : Yes
    Alternate group                          : 1
    Last edited by strawberryshortcake; 28th Apr 2018 at 21:51.
    Quote Quote  
  9. The first batch file requires AVS_Mpeg2Source.bat be in the same folder as the other files (or in Window's search path).

    For other types of sources you can change the *.VOB spec in the FOR loop. You'll need a different source filter in the AVS script. I'd use LSmashVideoSource() for MP4 files, LWlibavVideoSource() for most others. Then you have to change all the file deletions. I.e., there will be no d2v files with those other source filters. LSmash doesn't create an index file. LWlibav creates index files with the extension .lwi. And you'll have to install the LSmash package if you haven't already.

    I used the veryfast preset for x264 in those batch files so I wouldn't hat to wait long during testing. You can change that to whatever preset (or other parameters) you want.

    And remember, many things can go wrong with automated processing like this. So check the results.
    Quote Quote  
  10. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    The first batch file requires AVS_Mpeg2Source.bat be in the same folder as the other files (or in Window's search path).

    For other types of sources you can change the *.VOB spec in the FOR loop. You'll need a different source filter in the AVS script. I'd use LSmashVideoSource() for MP4 files, LWlibavVideoSource() for most others. Then you have to change all the file deletions. I.e., there will be no d2v files with those other source filters. LSmash doesn't create an index file. LWlibav creates index files with the extension .lwi. And you'll have to install the LSmash package if you haven't already.

    I used the veryfast preset for x264 in those batch files so I wouldn't hat to wait long during testing. You can change that to whatever preset (or other parameters) you want.

    And remember, many things can go wrong with automated processing like this. So check the results.

    Two concerns for this particular post:
    (1) Do my codes for .mp4 modified from your .vob .bat batch script look correct?
    (2) setsar=sar=8/9 value/expression and how it affects display aspect ratio.



    Just wanted to ensure the following are close to correct ...

    (A) For .VOB files (interlaced). This is essentially your code for .VOB files that are interlaced.

    Jagabo Blue Print Batch .bat script - this is obviously correct; this is your code for .vob files
    Code:
    if not exist GREENFLOWER md GREENFLOWER
    for %%A in ("*.VOB") do (
        "C:\Program Files (x86)\AMVpack\DGMPGDec\DGIndex.exe" -i "%%~A" -o "%%~dpnA" -fo 0 -om 2 -exit
        echo Mpeg2Source("%%~dpnA.d2v", CPU2="ooooxx", Info=3^) > "%%~A.avs"
        echo TFM(d2v="%%~dpnA.d2v"^) >> "%%~A.avs"
        echo TDecimate(^) >> "%%~A.avs"
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "GREENFLOWER\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
        del "%%~nA.d2v"
        del "%%~nA.d2v.bad"
        del "%%~nA.fix.txt"
    )
    pause

    Below are potentially my "final" version through test & trial code (as long as you don't find anything wrong with them). I basically made some educated guess on using your blueprint script above. Tested the below .bat batch file on several episodes of the same show and observed the output results. It seemed like it works but I'm not sure if the code is completely "proper". Did I add in any unnecessary tidbits, or am I missing some necessary tidbits?


    (B) For .mp4 files. Below is my .mp4 code hopefully. I'm thinking TFM and TDecimate are probably not necessary for progressive material, correct? Does the filters TFM and TDecimate hurt in any way, shape or form if added to a (progressive) .mp4?

    Note: My test does show that on progressive .mp4 material at 30 FPS, the addition of TFM and TDecimate to the .avs script does drop the frames per second to 24 FPS. Audio and video, I believe, does remain in sync which is good.

    .avs script with TFM and TDecimate for .mp4 files (does change .mp4 w/ 30FPS to new .mp4 w/ 24FPS
    Code:
    if not exist GREENFLOWER md GREENFLOWER
    for %%A in ("*.mp4") do (
        echo LSmashVideoSource("%%A"^) > "%%~A.avs"
        echo TFM(^) >> "%%~A.avs"
        echo TDecimate(^) >> "%%~A.avs"
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "GREENFLOWER\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
    )
    pause

    (C) For .mp4. This is the code without TFM or TDecimate, and I simply added one filter (hysteria). Original progressive .mp4 30FPS converts to new .mp4 30FPS. Audio and video remains in sync.

    Code:
    if not exist GREENFLOWER md GREENFLOWER
    for %%A in ("*.mp4") do (
        echo LSmashVideoSource("%%A"^) > "%%~A.avs"
        echo Hysteria(strength=20, usemask=true, lowthresh=6, highthresh=20, luma_cap=191, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune film -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a copy "GREENFLOWER\%%~nA.mp4"
        del "%%~nA*.AC3"
        del "%%A.AVS"
    )
    pause


    Part 2:
    setsar=sar=8/9. That expression worked perfectly fine to keep the display aspect ratio the same for .vob files and the subsequently converted .mp4 output file. But setsar=sar=8/9 did not sit so well with the original .mp4 files; setsar=sar=8/9 converted the original .mp4 file to an output new .mp4 with a display aspect ratio of 1:1.85. I adjusted the value to setsar=sar=3/3. Visually it looks correct, but is it actually properly correct?

    The most important question/concern is how do I determine the proper setsar=sar=??? value. Obviously, I would simply run the batch .bat file on a couple .mp4 first to determine the result, and make adjustments if needed, prior to running the .bat script on a larger number of .mp4 of the same show.

    The width of the rectangle is the width of the video. There are three stacked side by side.

    Top rectangle - .mp4 converted to .mp4 setsar=sar=8/9
    Middle - .mp4 original (did not undergo conversion)
    Bottom - .mp4 adjustment (I tried fiddling around the the setsar=sar=sar value as much as I could and came to the conclusion that setsar=sar=3/3 help get me the closest to a display aspect ratio of 4x3 (fullscreen); which matches up to the original .mp4 file. sar=8/9 kept the aspect ratio the same for .vob file, at least in this one example.

    Click image for larger version

Name:	Jagabox Aspect Ratio (SAR) f.png
Views:	16
Size:	342.5 KB
ID:	45448


    Click image for larger version

Name:	Jagabox Aspect Ratio (SAR) e.png
Views:	13
Size:	1.21 MB
ID:	45449
    Last edited by strawberryshortcake; 29th Apr 2018 at 06:35.
    Quote Quote  
  11. mp4 files are unlikely to contain telecined film so TFM().TDecimate() usually won't be needed. In you second script there is no AC3 file to delete. mp4 files are most likely to be square pixel, sar 1:1 (3:3 will work too). Or you can just leave out the setsar parameter and players will assume the videos are square pixel. Hysteria isn't appropriate for video other than cartoons. With cartoons you probably want -tune animation. Only use hqn3d if you need it. And consider changing the preset and crf.
    Last edited by jagabo; 29th Apr 2018 at 07:16.
    Quote Quote  
  12. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    mp4 files are unlikely to contain telecined film so TFM().TDecimate() usually won't be needed. In you second script there is no AC3 file to delete. mp4 files are most likely to be square pixel, sar 1:1 (3:3 will work too). Or you can just leave out the setsar parameter and players will assume the videos are square pixel. Hysteria isn't appropriate for video other than cartoons. With cartoons you probably want -tune animation. Only use hqn3d if you need it. And consider changing the preset and crf.



    EDIT: Disregard everything below for now, let me run a few more test. It should have been 720x480 not 480x360. Let me redo something.





    Update. Additional curiosity about the Sar and its effect on the display aspect ratio ... versus Spline64Resize.


    Doing several test runs using setsar=sar=?/? and nothing really completely "matches" the actual physical dimensions when played through VLC player. However, mediainfo does verify that certain setsar=sar=X/X do match the display aspect ratio of the test runs to the original mkv file. It's just that the visual inspection conflicts with mediainfo (picture below).

    On the other hand, using Spline64Resize (480,360) on first test run matches both the original .mkv file and the convert .mp4 DAR (display aspect ratio) for Mediainfo and on visual inspection when played through VLC player.

    Original mkv file 480/360 pixel (width/height); Display Aspect Ratio 4:3
    echo Spline64Resize(480,360^) >> "%%~A.avs" => Display Aspect Ratio 4:3
    Note: I did try to leave out setsar=sar=X/X but it didn't work. It's when I simply used Spline64Resize minus setsar did it finally work.

    Side Remark: I don't know if it's because the .mkv file was encoded with HVEC, but I had to add format="YUV420P8" to the code in order to get the picture right. Without format="YUV420P8", the picture was completely screwed up, green outline, purple,yellow, etc outlines everywhere. The only way I figured this out was when I dragged the original .mkv file into AVSPmod and in the script it show format="YUV420P8" immediately after the input file name.

    And yes, I'll fiddle with the different values such as CRF, tuning, etc depending on which video I want to convert. But just trying to get a "final blueprint" first for .vob, .mp4, .mkv files first.

    Click image for larger version

Name:	SAR vs Spline64.png
Views:	33
Size:	669.5 KB
ID:	45453

    Code:
    if not exist FLOWERPOWERmp4 md FLOWERPOWERmp4
    for %%A in ("*.mkv") do (
        echo LWLibavVideoSource("%%A",format="YUV420P8"^) > "%%~A.avs"    
        echo TFM(^) >> "%%~A.avs"
        echo TDecimate(^) >> "%%~A.avs"
        echo Spline64Resize(480,360^) >> "%%~A.avs"
        echo Hysteria(strength=6, usemask=true, lowthresh=6, highthresh=20, luma_cap=191, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryfast -tune animation -crf 24 -vf hqdn3d -c:a ac3 -b:a 192k "FLOWERPOWERmp4\%%~nA.mp4"
        del "%%A.AVS"
        del "%%~nA.LWI"
    )
    pause
    Last edited by strawberryshortcake; 29th Apr 2018 at 18:24.
    Quote Quote  
  13. The HEVC video may have been 10 bit, not 8 bit, hence the need to specify the format.

    The equation for aspect ratios is:

    Code:
    DAR = FAR * SAR
    
    DAR is the display aspect ratio, the final shape of the displayed picture
    FAR is the frame size aspect ratio, ie, width:height of the stored frame
    SAR is the sampling aspect ratio, the relative distance between samples horizontally and vertically,
        SAR sometimes call pixel aspect ratio, PAR, the shape of individual pixels
    So a 480x360 frames with a SAR of 1:1:

    Code:
    DAR = FAR * SAR
    DAR = 480:360 * 1:1
    DAR = (480/360) * (1/1)
    DAR = 480/360 * 1
    DAR = 1.333... = 4:3
    With a 720x480 4:3 DAR DVD:

    Code:
    DAR = FAR * SAR
    4:3 = 720:480 * SAR
    SAR = (4:3) / ( 720:480)
    SAR = (4/3) / (720/480)
    SAR = 1.333 / 1.5
    SAR = 0.888... = 8:9
    But there is a discrepancy between the MPEG 2 spec (used on DVD) and the ITU rec.601 video capture spec regarding aspect ratios. MPEG 2 directly supports only four aspect ratios: 4:3 DAR, 16:9 DAR, 2.21:1 DAR, and 1:1 SAR. Only two of those are allowed on DVD: 4:3 DAR and 16:9 DAR. And the spec says the DAR comes from the full frame size, 720x480 in our case. From that you can calculate the aforemetioned 8:9 SAR. But the ITU spec for video capture says the 4:3 picture in a 720x480 frame is in the inner 704x480 portion, meaning the SAR is 10:11 and the full 720x480 frame is slightly wider than 4:3. (The wider frame is captured in case the source or capture device is slightly off center.) When analog tape sources are captured for DVD they usually use ITU compliant devices. But the frame isn't reduced to 704x480 for DVD (even though DVD supports that size), it's left at 720x480 and flagged as 4:3 DAR, ignoring the difference between the MPEG 2 and ITU specs. So don't be surprised if you see people saying 4:3 DVD SAR is 10:11. Some software uses one, some the other.
    Quote Quote  
  14. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    The HEVC video may have been 10 bit, not 8 bit, hence the need to specify the format.

    The equation for aspect ratios is:

    Code:
    DAR = FAR * SAR
    
    DAR is the display aspect ratio, the final shape of the displayed picture
    FAR is the frame size aspect ratio, ie, width:height of the stored frame
    SAR is the sampling aspect ratio, the relative distance between samples horizontally and vertically,
        SAR sometimes call pixel aspect ratio, PAR, the shape of individual pixels
    So a 480x360 frames with a SAR of 1:1:

    Code:
    DAR = FAR * SAR
    DAR = 480:360 * 1:1
    DAR = (480/360) * (1/1)
    DAR = 480/360 * 1
    DAR = 1.333... = 4:3
    With a 720x480 4:3 DAR DVD:

    Code:
    DAR = FAR * SAR
    4:3 = 720:480 * SAR
    SAR = (4:3) / ( 720:480)
    SAR = (4/3) / (720/480)
    SAR = 1.333 / 1.5
    SAR = 0.888... = 8:9
    But there is a discrepancy between the MPEG 2 spec (used on DVD) and the ITU rec.601 video capture spec regarding aspect ratios. MPEG 2 directly supports only four aspect ratios: 4:3 DAR, 16:9 DAR, 2.21:1 DAR, and 1:1 SAR. Only two of those are allowed on DVD: 4:3 DAR and 16:9 DAR. And the spec says the DAR comes from the full frame size, 720x480 in our case. From that you can calculate the aforemetioned 8:9 SAR. But the ITU spec for video capture says the 4:3 picture in a 720x480 frame is in the inner 704x480 portion, meaning the SAR is 10:11 and the full 720x480 frame is slightly wider than 4:3. (The wider frame is captured in case the source or capture device is slightly off center.) When analog tape sources are captured for DVD they usually use ITU compliant devices. But the frame isn't reduced to 704x480 for DVD (even though DVD supports that size), it's left at 720x480 and flagged as 4:3 DAR, ignoring the difference between the MPEG 2 and ITU specs. So don't be surprised if you see people saying 4:3 DVD SAR is 10:11. Some software uses one, some the other.

    Update. Everything is all good now. Not sure what happened earlier but retesting sersar=sar=8/9 works perfectly fine now. I don't know why the encoded video pixel size was 480x360, but now it's back 720x480, and the display aspect ratio is now the same as the original mkv when measured using vlc player (simply visual observation, copy paste onto paint program, overlay the image on top of one another). Guess I did more work than needed.

    Mediainfo also confirms that values are now correct using 8/9 sar for both the original mkv and the newly encode .mp4

    And yes the Hvec was a 10bit. The newly encoded .mp4 file is now 8bit after adding format="YUV420P8".

    Not sure if Spline64Resize(720,480) is necessary in the code/script but I guess I can leave it in there...

    Click image for larger version

Name:	SAR vs Spline64 2.png
Views:	23
Size:	615.3 KB
ID:	45456



    EDIT: I'm surprise this forum doesn't have like a stickied list of avisynth code for specific encodes. The one that you created for me should be stickied somewhere and referred to as the jagabo code for _____
    Last edited by strawberryshortcake; 29th Apr 2018 at 20:41.
    Quote Quote  
  15. If your video is already 720x480 Spline64Resize(720,480) will do nothing.
    Quote Quote  
  16. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    If your video is already 720x480 Spline64Resize(720,480) will do nothing.
    Oh okay. Good to know. I'll just take it out. Cool. Appreciative. Good stuff.
    Quote Quote  
  17. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Attempting to test out Waifu2x (32 bit) Avisynth plugin, but am getting an error message:

    Cannot load a 32 bit DLL in 64 bit Avisynth: 'C:/Program Files (x86)/AviSynth/Plugins/Waifu2xAvisynth.dll'

    I believe I have both Avisynth version (32 and 64bit installed). The following is my plugins folder for the (x86) 32 bit AviSynth. Disregard the red box. This picture is a screenshot I created a few days ago that pertains to something else.
    Click image for larger version

Name:	Avisynth HYSTERIA fixmaybe b.png
Views:	20
Size:	1.20 MB
ID:	45465.

    I doubled clicked on my personalization of a jagabo .bat batch blueprint file and get the error code above. How do I get my "code" to "use" or "point" to using the 32 bit Avisynth just for this code alone. Yes, the above Waifu2xAvisynth.dll plugin is in the (x86) 32 bit Avisynth plugin folder. I've already checked my Avisynth+ (64bit) plugin folder and Waifu2xAvisynth.dll is not in there.

    The code probably has redundant filters, maybe. And the order of the filters maybe incorrect, not sure yet.

    Code:
    if not exist FLOWERPOWERsantig33andhysteria10___32bit2 md FLOWERPOWERsantig33andhysteria10___32bit2
    for %%A in ("*.mkv") do (
        echo Import("C:\Program Files (x86)\AviSynth\plugins\FastLineDarkenMod.avsi"^) >> "%%~A.avs"
        echo LWLibavVideoSource("%%A",format="YUV420P8"^) > "%%~A.avs"
        echo LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\Waifu2xAvisynth.dll"^) >> "%%~A.avs"
        echo Waifu2x(nr=2, scale=1, jobs=1, models="C:\Program Files (x86)\AviSynth\waifu2xAvisynth-models\models"^) >> "%%~A.avs"   
        echo FFT3Dfilter(sigma=1.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.4, plane=4^) >> "%%~A.avs"
        echo RemoveGrain(mode=1, planar=false^) >> "%%~A.avs"   
        echo FastLineDarkenMOD(^) >> "%%~A.avs"
        echo Hysteria(strength=10, usemask=true, lowthresh=20, highthresh=50, luma_cap=250, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
        echo Santiag(3,3^) >> "%%~A.avs"
        "C:\Program Files (x86)\AMVpack\AMVtool64\ffmpeg.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryslow -tune animation -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a ac3 -ac 2 -b:a 128k "FLOWERPOWERsantig33andhysteria10___32bit2\%%~nA.mp4"
        del "%%A.AVS"
        del "%%~nA*.LWI"
    )
    pause
    Last edited by strawberryshortcake; 30th Apr 2018 at 18:03.
    Quote Quote  
  18. 32 bit plugins can't be used by 64 bit AviSynth, and vice versa.

    If you have both 32 bit and 64 bit AviSynth installed: if you open a scrip with a 32 bit editor/player you will end using 32 bit AviSynth, if you open a script with a 64 bit editor/player you will be using 64 bit AviSynth.

    By the way, the waifu2x plugin is very very slow. After a few test you won't end up using it.
    Quote Quote  
  19. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    32 bit plugins can't be used by 64 bit AviSynth, and vice versa.

    If you have both 32 bit and 64 bit AviSynth installed: if you open a scrip with a 32 bit editor/player you will end using 32 bit AviSynth, if you open a script with a 64 bit editor/player you will be using 64 bit AviSynth.

    By the way, the waifu2x plugin is very very slow. After a few test you won't end up using it.
    I guess I'll put this in the back burner for now and re-try it during the weekend because it didn't quite work. I downloaded notepad++ (32bit), reopened the .bat batch file, save it using Notepad++(32bit), double clicked on the .bat file and it still said

    [Fatal]: failed to avformat_open_input. (Hysteria (.mkv) FINAL - waifux test 32bit - Copy (notepad 32bit).AVS, line 1 Hysteria (.mkv) FINAL - waifux test 32bit - Copy (notepad 32bit).AVS: Unknown error occured


    But more important, I simply wanted to use Waifu2x or any filter that will clean up the "noise" around solid lines for animations.

    ================================================== ==========



    What's the most effective way to denoise or remove noise around solid lines in cartoons/animation? Also what exactly are these "noise" "artifacts" called?

    Both of these have hysteria and fastlinedarkenmod applied and introduced a bit more of these noise/artifacts but ultimately my main goal was to darken the lines so that was achieved. But I want to know how to "remove" "eliminate" or "minimize" the noise.
    Click image for larger version

Name:	Noise test a NOISE.png
Views:	12
Size:	210.3 KB
ID:	45475Click image for larger version

Name:	Noise test a.png
Views:	13
Size:	577.3 KB
ID:	45471



    TWO CONCERNS: how to minimize or remove noise around solid lines? Which filter to use?
    (1) Better denoise / noise removal (or minimize) tool
    (2) Connect the dots for solid lines that aren't quite solid (last set of images below; notice Bart's eyes on the top and Bart's eye on the bottom image. They are two different frames. Both frames already have the hysteria and fastlinedarkenmod applied)


    FIRST CONCERN
    Set of images below has two critical plugin filters applied (top image - filter applied, bottom image no filter applied):
    (A) Hysteria
    (B) FastlineDarkenMod

    Code:
    if not exist FLOWERPOWERsantig33andhysteria10_____ md FLOWERPOWERsantig33andhysteria10_____
    for %%A in ("*.mkv") do (
        echo Import("C:\Program Files\AviSynth+\plugins64\FastLineDarkenMOD.avsi"^) >> "%%~A.avs"
        echo LWLibavVideoSource("%%A",format="YUV420P8"^) > "%%~A.avs"
        echo FFT3Dfilter(sigma=1.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.4, plane=4^) >> "%%~A.avs"
        echo RemoveGrain(mode=1, planar=false^) >> "%%~A.avs"   
        echo FastLineDarkenMOD(^) >> "%%~A.avs"
        echo Hysteria(strength=10, usemask=true, lowthresh=20, highthresh=50, luma_cap=250, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
        echo Santiag(3,3^) >> "%%~A.avs"
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryslow -tune animation -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a ac3 -ac 2 -b:a 128k "FLOWERPOWERsantig33andhysteria10_____\%%~nA.mp4"
        del "%%A.AVS"
        del "%%~nA*.LWI"
    )
    pause



    Click image for larger version

Name:	Noise test c (hysteria fastlinedarkmod).png
Views:	19
Size:	404.1 KB
ID:	45466Click image for larger version

Name:	Noise test c (no filter).png
Views:	16
Size:	403.1 KB
ID:	45472

    Click image for larger version

Name:	Noise test d (hysteria fastlinedarkenmod).png
Views:	27
Size:	383.8 KB
ID:	45470Click image for larger version

Name:	Noise test d (no filter).png
Views:	45
Size:	364.2 KB
ID:	45467

    Notice when you enlarge the top image of homer (hysteria and fastlinedarkenmod applied to just the top image), homer does have noise around the solid lines. Trying to get rid of these.
    Click image for larger version

Name:	Noise test b (hysteria fastlinedarkenmod).png
Views:	30
Size:	459.4 KB
ID:	45469Click image for larger version

Name:	Noise test b (no line darkening filter).png
Views:	14
Size:	449.2 KB
ID:	45474



    SECOND CONCERN: connect the dots?

    Secondly, is there an Avisynth filter that will "connect" the dots. Notice the lining on Bart's eye is scattered/patches of disconnected dots. The same bart image below is a couple frames after and notice how the lines are solid. Is there a filter that can "connect" these dots?

    Click image for larger version

Name:	Noise test g (disconnect).png
Views:	16
Size:	587.4 KB
ID:	45468Click image for larger version

Name:	Noise test g (solid).png
Views:	31
Size:	544.9 KB
ID:	45473
    Last edited by strawberryshortcake; 30th Apr 2018 at 19:49.
    Quote Quote  
  20. Originally Posted by strawberryshortcake View Post
    What's the most effective way to denoise or remove noise around solid lines in cartoons/animation? Also what exactly are these "noise" "artifacts" called?
    Those are DCT ringing artifacts. They come from lossy compression and are exacerbated by sharpening and line darkening filters. They can be reduced with noise reduction filter but you may loose detail in other parts of the picture. One way to reduce that is to use an edge mask so the strong noise reduction is only applied near edges. Something like:

    Code:
    # YV12 video
    before = last
    UnDot() # removes some single dots
    TNLMeans(Ax=3, Ay=3, Az=1) # general 3d noise reduction
    edgemask = mt_edge().mt_expand().mt_inpand().mt_inpand().mt_expand().mt_expand().mt_expand(chroma="-128").BinomialBlur(3.0) # a mask of edges, expanded and blurred
    Overlay(before ,last, mask=edgemask) # only apply TNLMeans near edges, preserves detain in other parts of the picture
    TNLMeans is slow but far faster than Waifu2x.

    One hint: in your batch files remove the line that deletes the AVS script. Then you can examine the script to be sure it contains what you intended.
    Quote Quote  
  21. The last one, the "disconnected dots" looks like a deinterlaced frame (deinterlacing artifacts, aliasing) . Frame is resized so it's difficult to say for certain.

    It might be from a bad IVTC (missing match), or it might be bad source . The batch says "mkv" so if that was from makemkv, it might be from that (mpeg2 in mkv has potential for lots of problems)
    Quote Quote  
  22. I modified the waifu2x script to get it working here. You'll have to change paths to get this working on your computer.

    Code:
    if not exist GREENFLOWER md GREENFLOWER
    for %%A in ("*.mp4") do (
        echo # automated script > "%%~A.avs"
        echo Import("C:\Program Files (x86)\AviSynth\plugins\FastLineDarkenMod.avs"^) >> "%%~A.avs"
        echo Import("C:\Program Files (x86)\AviSynth\plugins\Santiag.avs"^) >> "%%~A.avs"
        echo LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\Waifu2xAvisynth.dll"^) >> "%%~A.avs"
        echo.  >> "%%~A.avs"
        echo LSmashVideoSource("%%A",format="YUV420P8"^) >> "%%~A.avs"
        echo ConvertToYV24(^) >> "%%~A.avs"
        echo Waifu2x(nr=2, scale=1, jobs=1, models="C:\Program Files (x86)\AviSynth\plugins\models"^) >> "%%~A.avs"   
        echo ConvertToYV12(^) >> "%%~A.avs"
        echo FFT3Dfilter(sigma=1.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.4, plane=4^) >> "%%~A.avs"
        echo RemoveGrain(mode=1, planar=false^) >> "%%~A.avs"   
        echo FastLineDarkenMOD(^) >> "%%~A.avs"
        echo Hysteria(strength=10, usemask=true, lowthresh=20, highthresh=50, luma_cap=250, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
        echo Santiag(3,3^) >> "%%~A.avs"
    
    REM     "G:\Program Files\ffmpeg\bin\ffmpeg.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset slow -tune film -crf 18 -c:a copy "GREENFLOWER\%%~nA.mp4"
    REM    del "%%A.AVS"
    )
    The script starts by erasing any existing script of the same name and writing a comment, "# automated scrpt". I did this so I wouldn't have to worry about whether later lines started the script or appended to the script if I rearranged them -- all the later lines append. I then import all the filters that need importing. Note that FastLineDarkenMod and Santiag are AVS script stored in AviSynth's plugins folder (so they are not autoloaded). Waifu2xAvisynth.dll is also in AviSynth's plugins folder so it does not need to explicitly be loaded here. I opened the source with LSmashVideoSource() since mp4 files are already indexed. I then applied the filters you had in your script. Waifu claims to work with YV12 but I couldn't get it to work, so I convert to YV24 before calling it, back to YV12 after (at least some of the later filters don't work with YV24). Here the ffmpeg and delete lines are commented out so I could verify the building of the script worked as intended. I opened the script in 32 bit VirtualDub for verification.

    I haven't seen a 64 bit version of waifu2xAvisynth.dll so everything above has only been tested with 32 bit AviSynth. If anyone knows a 64 bit Waifu build, let me know.

    I think you misunderstood something I said earlier. I said that 64 bit AviSynth requires 64 bit filters and editors. But the "editor" part meant video editor (or encoder, or player), not the text editor that's used to create the script. How you create the text file doesn't matter.
    Last edited by jagabo; 1st May 2018 at 11:44.
    Quote Quote  
  23. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    Originally Posted by strawberryshortcake View Post
    What's the most effective way to denoise or remove noise around solid lines in cartoons/animation? Also what exactly are these "noise" "artifacts" called?
    Those are DCT ringing artifacts. They come from lossy compression and are exacerbated by sharpening and line darkening filters. They can be reduced with noise reduction filter but you may loose detail in other parts of the picture. One way to reduce that is to use an edge mask so the strong noise reduction is only applied near edges. Something like:

    Code:
    # YV12 video
    before = last
    UnDot() # removes some single dots
    TNLMeans(Ax=3, Ay=3, Az=1) # general 3d noise reduction
    edgemask = mt_edge().mt_expand().mt_inpand().mt_inpand().mt_expand().mt_expand().mt_expand(chroma="-128").BinomialBlur(3.0) # a mask of edges, expanded and blurred
    Overlay(before ,last, mask=edgemask) # only apply TNLMeans near edges, preserves detain in other parts of the picture
    TNLMeans is slow but far faster than Waifu2x.

    One hint: in your batch files remove the line that deletes the AVS script. Then you can examine the script to be sure it contains what you intended.

    Image
    [Attachment 45479 - Click to enlarge]


    I ensured the .dll was 64bit. I tested out both KNLmeans.dll and TNLmeans.dll. Both came back with the unexpected character "" error. I opened both .dll files with Notepad++ but that failed miserably. They were basically giberrish symbols.

    Code:
    Import("C:\Program Files\AviSynth+\plugins64\TNLMeans.dll")

    Question: Also how do I know when to use IMPORT vs LOADPLUGIN?
    Does it have anything to do with the extension?

    Import (.avs) vs. Loadplugin (.dll)

    Code:
      echo Import("C:\Program Files (x86)\AviSynth\plugins\FastLineDarkenMod.avs"^) >> "%%~A.avs"
        echo Import("C:\Program Files (x86)\AviSynth\plugins\Santiag.avs"^) >> "%%~A.avs"
        echo LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\Waifu2xAvisynth.dll"^) >>

    According to the following website, Santiag doesn't have a 64bit plugin...

    http://avisynth.nl/index.php/AviSynth%2B_x64_plugins

    http://avisynth.nl/index.php/Santiag

    Also for some reason, in AVSPMod, I don't have F5 works when the Santiag value changes and I didn't use Import or Loadplugin.



    With the following code, do I need Import(Santiag)??? Is the following code not "applying" the Santiag anti-aliasing filter since i don't have Import(santiag) in there?


    Code:
    if not exist FLOWERPOWERsantig33andhysteria10_____ md FLOWERPOWERsantig33andhysteria10_____
    for %%A in ("*.mkv") do (
        echo Import("C:\Program Files\AviSynth+\plugins64\FastLineDarkenMOD.avsi"^) >> "%%~A.avs"
        echo LWLibavVideoSource("%%A",format="YUV420P8"^) > "%%~A.avs"
        echo FastLineDarkenMOD(^) >> "%%~A.avs"
        echo FFT3Dfilter(sigma=1.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.4, plane=4^) >> "%%~A.avs"
        echo RemoveGrain(mode=1, planar=false^) >> "%%~A.avs"   
        echo Hysteria(strength=10, usemask=true, lowthresh=20, highthresh=50, luma_cap=250, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
        echo Santiag(3,3^) >> "%%~A.avs"
        "C:\Program Files\ImageMagick-7.0.2-Q16\ffmpeg2.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset veryslow -tune animation -crf 24 -vf hqdn3d,setsar=sar=8/9 -c:a ac3 -ac 2 -b:a 128k "FLOWERPOWERsantig33andhysteria10_____\%%~nA.mp4"
        del "%%A.AVS"
        del "%%~nA*.LWI"
    )
    pause








    Originally Posted by jagabo View Post
    I modified the waifu2x script to get it working here. You'll have to change paths to get this working on your computer.

    Code:
    if not exist GREENFLOWER md GREENFLOWER
    for %%A in ("*.mp4") do (
        echo # automated script > "%%~A.avs"
        echo Import("C:\Program Files (x86)\AviSynth\plugins\FastLineDarkenMod.avs"^) >> "%%~A.avs"
        echo Import("C:\Program Files (x86)\AviSynth\plugins\Santiag.avs"^) >> "%%~A.avs"
        echo LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\Waifu2xAvisynth.dll"^) >> "%%~A.avs"
        echo.  >> "%%~A.avs"
        echo LSmashVideoSource("%%A",format="YUV420P8"^) >> "%%~A.avs"
        echo ConvertToYV24(^) >> "%%~A.avs"
        echo Waifu2x(nr=2, scale=1, jobs=1, models="C:\Program Files (x86)\AviSynth\plugins\models"^) >> "%%~A.avs"   
        echo ConvertToYV12(^) >> "%%~A.avs"
        echo FFT3Dfilter(sigma=1.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.4, plane=4^) >> "%%~A.avs"
        echo RemoveGrain(mode=1, planar=false^) >> "%%~A.avs"   
        echo FastLineDarkenMOD(^) >> "%%~A.avs"
        echo Hysteria(strength=10, usemask=true, lowthresh=20, highthresh=50, luma_cap=250, maxchg=255, minchg=0, showmask=false^) >> "%%~A.avs"
        echo Santiag(3,3^) >> "%%~A.avs"
    
    REM     "G:\Program Files\ffmpeg\bin\ffmpeg.exe" -i "%%A.AVS" -i "%%A" -map 0:0 -map 1:a:0 -y -c:v libx264 -preset slow -tune film -crf 18 -c:a copy "GREENFLOWER\%%~nA.mp4"
    REM    del "%%A.AVS"
    )

    Note: Had do remove some of the other stuff; AVSPmod 32bit "function not found" for fastlinedarkenMOD, etc. I just wanted to see to if Waifu2x works and simply kept Waifu2x in the script, and everything else barebones (i.e. no other filters). The AVPSmod 64bit has fastlinedarkenMOD and the other plugin filters loaded properly and working.

    Managed to get Waifu2x to work, and

    Image
    [Attachment 45481 - Click to enlarge]


    Image
    [Attachment 45482 - Click to enlarge]


    19KB finished after 1 hour. Almost 1 second of video.

    Image
    [Attachment 45483 - Click to enlarge]


    That's going into the "to never do again pile". Waifu2x is not going to work until I upgrade my computer.

    If anything I might as well use the portable Waifu2x isolated program, which I did give a test run about a month ago and cleaning up 32,000 frames (approximate length of 1 22 minute episode of anything) takes about 12 to 22 day depending on the level of detail in each frame. Too bad I don't have Nvidia GPU because that would cut down the time by a magnitude of x5.

    Here's their website that demos the power of Waifu2x. Maximum 5 frames at a time.
    http://waifu2x.me/


    Time to figure out how to get NLmeans to work.
    Last edited by strawberryshortcake; 1st May 2018 at 17:40.
    Quote Quote  
  24. Regarding tnlmeans, post your entire AVS script.
    Quote Quote  
  25. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    Regarding tnlmeans, post your entire AVS script.

    Now, it works. Had to dig a bit deeper to find the treasure.

    NLmeans 64bit
    https://forum.doom9.org/showthread.php?p=1374605#post1374605
    NLmeans 64bit
    http://www.mediafire.com/?y4e3zd2zodd

    Haven't added all the filter, but this is just a test run in AVSPmod 64 bit to see if it works using the preview F5 function (or simply mouse clicking the preview screen will automatically preview the changes)
    Code:
    LWLibavVideoSource("U:\( Folder ) External\-----------Simpsons @@@@  (4 x 3 versions)\The Simpsons S01E01 - Simpsons Roasting on an Open Fire.mkv", format="YUV420P8")
    FastLineDarkenMOD() 
    FFT3Dfilter(sigma=1.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.4, plane=4) 
    RemoveGrain(mode=1, planar=false)    
    Hysteria(strength=50, usemask=true, lowthresh=20, highthresh=50, luma_cap=250, maxchg=255, minchg=0, showmask=false) 
    Santiag(3,3) 
    LoadPlugin("C:\Program Files\AviSynth+\plugins64\TNLMeans.dll")
    TNLmeans(Ax=3, Ay=3, Az=1)
    Quote Quote  
  26. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    On the other hand, I might have to find something else other than undot seeing as how there's not a 64bit version. I could move everything over to the 32bit AVSPmod though. That would be my last resort.
    Quote Quote  
  27. Originally Posted by strawberryshortcake View Post
    On the other hand, I might have to find something else other than undot seeing as how there's not a 64bit version. I could move everything over to the 32bit AVSPmod though. That would be my last resort.
    RemoveGrain(1) is the same as undot, except faster
    Quote Quote  
  28. Member
    Join Date
    May 2016
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Originally Posted by strawberryshortcake View Post
    On the other hand, I might have to find something else other than undot seeing as how there's not a 64bit version. I could move everything over to the 32bit AVSPmod though. That would be my last resort.
    RemoveGrain(1) is the same as undot, except faster


    Is it the one I'm already using? Even though I don't see the RemoveGrain.dll in my plugin 64bit folder but for whatever reason it works in AVSPMod.

    I did see a RemoveGrainHD though.

    Code:
    LWLibavVideoSource("U:\( Folder ) External\-----------Simpsons @@@@  (4 x 3 versions)\The Simpsons S01E01 - Simpsons Roasting on an Open Fire.mkv", format="YUV420P8")
    FastLineDarkenMOD() 
    FFT3Dfilter(sigma=1.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.4, plane=4) 
    RemoveGrain(mode=1, planar=false)    
    Hysteria(strength=50, usemask=true, lowthresh=20, highthresh=50, luma_cap=250, maxchg=255, minchg=0, showmask=false) 
    Santiag(3,3) 
    LoadPlugin("C:\Program Files\AviSynth+\plugins64\TNLMeans.dll")
    TNLmeans(Ax=3, Ay=3, Az=1)
    Quote Quote  
  29. For waifu2x - the avisynth version never got optimizations , and was abandoned. No SIMD , nothing like SSE2/AVX support. No GPU support. It's basically unusable

    It's available in vapoursynth with optimizations. The caffe (cuda) version is much faster (depending on nvidia card, maybe 20-200x faster) . But even the w2xc version is probably 10-20x faster than the avisynth version because it can use SSE2/AVX , even OpenCL (both AMD and Intel).

    But its not fun using vapoursynth at first unless you're familiar with python. More difficult to learn than avisynth. I'm a good test subject because I don't have any programming knowledge
    Quote Quote  
  30. Originally Posted by strawberryshortcake View Post
    Originally Posted by poisondeathray View Post
    Originally Posted by strawberryshortcake View Post
    On the other hand, I might have to find something else other than undot seeing as how there's not a 64bit version. I could move everything over to the 32bit AVSPmod though. That would be my last resort.
    RemoveGrain(1) is the same as undot, except faster


    Is it the one I'm already using? Even though I don't see the RemoveGrain.dll in my plugin 64bit folder but for whatever reason it works in AVSPMod.

    I did see a RemoveGrainHD though.
    For x64 it's available through RgTools . It's a re-write of the original RemoveGrain . But you still call it in the script RemoveGrain(whatever settings) ; it's just that the .dll is RgTools.dll
    Quote Quote  



Similar Threads