VideoHelp Forum
+ Reply to Thread
Page 2 of 6
FirstFirst 1 2 3 4 ... LastLast
Results 31 to 60 of 172
Thread
  1. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    Ok, that was a stupid mistake haha

    I wasn't aware InpaintDelogo.avsi was still a txt file. It's a .avsi file now.

    What required plugins are missing? I have 3 files in the plugin64 folder:
    - AvsInPaint.dll
    - InpaintDelogo.avsi
    - LSMASHSource.dll

    AvsPmod is now mentioning something about a missing function "mt_expand" in line 1520 of InPaintDelogo.avsi
    Quote Quote  
  2. Given the color of the timestamp it should be pretty easy to build a dynamic mask in AviSynth:

    Code:
    hsm = MaskHS(StartHue=140, EndHue=170, MinSat=20, MaxSat=80) # build mask of orange pixels
    hsm = hsm.Crop(20,1000,-1390,-16).AddBorders(20,1000,1390,16).mt_expand() # restrict the mask to the timestamp area
    Image
    [Attachment 65073 - Click to enlarge]


    A new mask is built for every frame. The only problem you might have is when there is other orange stuff in that area.
    Quote Quote  
  3. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    So, after having:
    - AvsInPaint.dll
    - InpaintDelogo.avsi
    - LSMASHSource.dll

    I also need to install (put them into the plugin folder) the following?:
    - MaskTools2 ( https://github.com/pinterf/masktools ).
    - RgTools ( https://github.com/pinterf/RgTools ).
    - GRunT ( https://github.com/pinterf/GRunT ).
    - RequestLinear ( https://github.com/pinterf/TIVTC ).
    - ClipBlend ( http://avisynth.nl/index.php/ClipBlend ).
    - RT_Stats ( http://avisynth.nl/index.php/RT_Stats ).
    - FrameSel ( http://avisynth.nl/index.php/FrameSel ).
    - GrainFactory3 ( http://avisynth.nl/index.php/GrainFactory3 ).
    - vsTEdgeMask ( https://github.com/Asd-g/AviSynth-vsTEdgeMask ).



    Originally Posted by jagabo View Post
    Given the color of the timestamp it should be pretty easy to build a dynamic mask in AviSynth:

    Code:
    hsm = MaskHS(StartHue=140, EndHue=170, MinSat=20, MaxSat=80) # build mask of orange pixels
    hsm = hsm.Crop(20,1000,-1390,-16).AddBorders(20,1000,1390,16).mt_expand() # restrict the mask to the timestamp area
    Image
    [Attachment 65073 - Click to enlarge]


    A new mask is built for every frame. The only problem you might have is when there is other orange stuff in that area.
    This mask looks good to, but I actually don't know how to use this code (yet). It seems I'm actually having a hard time getting AviSynth working at the moment. It's completely new for me
    Quote Quote  
  4. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by jagabo View Post
    I also need to install (put them into the plugin folder) the following?.
    Yes.
    Quote Quote  
  5. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    Ok thanks, thought only the first plugins where necessary. Going to install them now

    I was actually looking for directions on Youtube on how to install it. But it's actually impressive to see what this program is capable of
    https://www.youtube.com/watch?v=OulrI4yaz64

    I should spend more time and learn more from it!
    Last edited by Rockel83; 29th May 2022 at 14:26.
    Quote Quote  
  6. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    Oh wow! This is so cool! I finally got it working in AvsPmod!

    It takes some time starting up and to get results in AVSmeter. First I thought it wasn't even responding. Playback in AVSPmod looks like slowmo. But guess it's not that strange because it's generating an overlay/mask on every frame.

    But I've noticed in "slow mo" that sometimes the last digit is getting hrough. Probably not that noticeable on normall speed, but could I improve this somehow?

    Image
    [Attachment 65083 - Click to enlarge]


    But thanks a lot for your time and effort!

    How do I export/save a recording with the applied mask now?
    Quote Quote  
  7. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Remove that "version()" from script.
    It's slow because inpainting is slow, it's probably 100 times slower than mask generation.
    If you want to preview a mask then add Show=4 parameter [Show=0 to disable mask preview].

    In the last frames a last digit mask gets borked because its duration is shorter than 52 frames [Dyn3Seq=52], later I'll show you how to correct it.
    Share a video sample where it "is getting hrough" [by PM if you want].
    Quote Quote  
  8. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    Well, it's no problem being slow, as long as it does it's job (which it seems to do).

    When saved and playbacked it probably will run at the normall 100% speed. So no problem then.

    Talking about saving, how do I save this with the aplied mask? Don't see an option for doing so in AvsPmod
    Quote Quote  
  9. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    You can encode with ffmpeg.
    What you want to save if you said that you are not getting a proper mask?
    Quote Quote  
  10. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Now I got why you've a bad mask, because DynColorTol should be 40 instead of 30.

    And to get not broken mask on the last frames we repeat the last frame 60 times, then after inpainting we remove those 60 frames:

    v = LWLibAvVideoSource("D:\Pachacamac E.MP4")
    x = v.Trim(v.FrameCount,-1).loop(60)
    v+x
    InpaintDelogo(Loc="4,990,-1380,-4", DynMask=3, DynTune=150, DynColor=$FFB900, DynColorTol=40, Dyn3Seq=52, DynInflate=2)
    Trim(0, FrameCount - 61)
    This script should be universal for all videos done on your camera with same settings, just replace video filename accordingly.
    Quote Quote  
  11. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    What's actually the difference between DynColorTol 30 and 40? What does the difference do?

    Thanks! This script (with show=4 removed) seems to cover up the timestamp even better! Only saw a tiny spot in the start. The bigger spots at the end are gone now! I'm happy with the result so far. It's probably even not noticeable on normall speed.

    Code:
    v = LWLibAvVideoSource("D:\Pachacamac E.MP4")
    x = v.Trim(v.FrameCount,-1).loop(60)
    v+x
    InpaintDelogo(Loc="4,990,-1380,-4", DynMask=3, DynTune=150, DynColor=$FFB900, DynColorTol=40, Dyn3Seq=52, DynInflate=2)
    Trim(0, FrameCount - 61)
    I'm still figuring out how to use ffmpeg though. I Notice it's command line based. And I'm struggeling a bit with it. Found the command options so far, but they're a lot haha

    Do I need to adjust something here? Or is the output standard the same as the input, with the difference of the applied mask?

    For example, when the input video has a specific resolution, framerate, quality etc. Will the output video have the same resolution, framerate, quality then? Or do I need to configure something first?
    Quote Quote  
  12. About the simplest ffmpeg command line is:

    Code:
    ffmpeg -i input.avs output.mp4
    That will get you a mp4 file with avc video and aac audio. A simple drag/drop batch file:

    Code:
    Start /b /low "ffmpeg" "G:\program files\ffmpeg64\bin\ffmpeg.exe" ^
        -i %1 ^
        -c:v libx264 -preset slow -crf 18 -g 50 ^
        -profile:v high -level:v 4.2 -colorspace bt709 -color_range tv ^
        -acodec aac  -b:a 192K ^
        "%~dpn1.avc.mkv"
    pause
    Quote Quote  
  13. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    Thanks! I've managed to generate an output file, and the results look really good on normal speed!
    I've only noticed that I don't have anny sound on the output file.

    Did I do annything wrong or am I missing something?

    I've also noticed that there's a big difference in file size between the orriginal and the output file. The output file is about 1/3 of the size.

    I would like to keep the quality as close to that of the orriginal, and I'm not sure if this is the case now. Because I think 1/3 is actually a big difference.

    Image
    [Attachment 65108 - Click to enlarge]


    https://www.youtube.com/watch?v=ZdQOwsBf_kQ

    https://www.youtube.com/watch?v=oMf2t9cG6T8

    (there should be some sounds around 1:00)
    Quote Quote  
  14. You probably didn't include the audio in your AviSynth script.

    Code:
    a = LWLibAvAudioSource("D:\Pachacamac E.MP4") # get audio
    v = LWLibAvVideoSource("D:\Pachacamac E.MP4") # get video
    AudioDub(v,a) # join audio and video into a single stream
    Quote Quote  
  15. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by Rockel83 View Post
    What's actually the difference between DynColorTol 30 and 40? What does the difference do?

    Thanks! This script (with show=4 removed) seems to cover up the timestamp even better! Only saw a tiny spot in the start. The bigger spots at the end are gone now! I'm happy with the result so far.
    DynColorTol is color tolerance, allowed color difference of a DynColor value [pixels outside that difference - doesn't get into a mask], so more laxed thresholding settings = bigger mask, bigger mask = worse inpaiting, so you want to get a small mask as possible when covering a timestamp completely.
    With those InpaintDelogo parameters we are mixing DynTune & DynColor masks and then temporally averaging that mix with Dyn3Seq, then expanding it by few pixels with DynInflate to cover possible artifacts/color bleeds.

    If you are proficient with Avisynth like @jagabo and you think that you can produce a better mask than InpaintDelogo then you can build your own external mask and supply it to InpaintDelogo with DynMask=1 & mask parameters.

    If you open InpaintDelogo.avsi with Notepad, there at top you'll find the help about all parameters.

    You can't "cover" anything with Show=4, it's to see a preview of a mask.

    If you got some spot not covered, then some setting needs to be laxed, only you can know as you didn't shared a video sample, maybe try to bump up DynColorTol to 50 and see if that spot disappears.

    Originally Posted by Rockel83 View Post
    I'm still figuring out how to use ffmpeg though. I Notice it's command line based. And I'm struggeling a bit with it.
    Try AvsPmod > Tools > Script Encoder (CLI) > Run.
    Your audio doesn't need to be re-compressed as you don't edit it.
    Use MKVToolNix to mux in ["merge"] audio from a original file with new encoded video.

    Originally Posted by Rockel83 View Post
    For example, when the input video has a specific resolution, framerate, quality etc. Will the output video have the same resolution, framerate, quality then?.
    Resolution, framerate should be same. CRF setting adjust quality, CRF in the range of 19 - 21 should produce good quality [lower CRF = more quality, but bigger files], 17 - 19 range produce very good quality, make two encodes with different CRF, compare, if you don't see a difference then use higher.

    Originally Posted by Rockel83 View Post
    Did I do annything wrong or am I missing something?
    Use MediaInfo if you want to share/see info about video file.
    Quote Quote  
  16. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    Thanks for explaining things!

    But isn't there a way to get the audio in the encoded video right away? So I will have the same exact audio in the new video with the removed timestamp? It's kind of rebuilding the video, applying the mask to every single frame if I'm correct? So I suppose there could be a way to copy/ rebuild the audio into the same new video? Well at least I hope haha.
    The default settings of my camera split up recordings to, besides turning on the timestamp. But there are a few frames overlapping. I think I should get some delays in sound when I put these video's together again. So having the exact sound in new encoded video should be verry helpfull.

    I've tried to apply the mask to another video. And I think it looks good too!
    Only in the beginning (the verry first frames) one of the last digits of the timestamp gets through. Could I improve this adjusting something?

    Orriginal:
    https://www.youtube.com/watch?v=pIigLP5u6DQ

    Output:
    https://www.youtube.com/watch?v=qOo76c9LdV4

    Here are the orriginal files:
    https://we.tl/t-Ak7PcUMjMZ
    Quote Quote  
  17. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by jagabo View Post
    MaskHS
    Is there an easy way of getting Hue/Sat values from RGB/YUV color value?

    Btw, your posted script didn't produce same result as in screenshot.
    Quote Quote  
  18. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by Rockel83 View Post
    But isn't there a way to get the audio in the encoded video right away?
    Not without re-ecoding audio, re-encoding degrades quality, and there is no reason to do that as you don't edit audio, so muxing in an original audio later is the right way to do this.

    Originally Posted by Rockel83 View Post
    The default settings of my camera split up recordings to...
    Ah, that's why you get a mask artifact on the first second, camera splits footage but doesn't restart a timestamp, so a last digit's duration at start can be shorter than "52" frames...

    I'll post updated script later, now I must go...
    Quote Quote  
  19. Originally Posted by Rockel83 View Post
    But isn't there a way to get the audio in the encoded video right away?
    ffmpeg can mux the original audio while compressing the video from your script. Assuming a source mp4 video has the same base name as the AVS script and is in the same folder, for example

    My Video.mp4
    My Video.AVS

    Code:
    "G:\program files\ffmpeg64\bin\ffmpeg.exe" -y ^
        -i "%~dpnx1" ^
        -i "%~dpn1.mp4" ^
        -map 0:v -map 1:a ^
        -c:v libx264 -preset slow -crf 18 -g 50 ^
        -acodec aac -b:a 192K ^
        -colorspace bt709 -color_range tv ^
        "%~dpn1.avc+aac.mp4"
    pause
    -i "%~dpnx1" imports the avs script
    -i "%~dpn1.mp4" imports the audio and video from the mp4 file
    -map 0:v -map 1:a keeps the video from the first import, the audio from the second import
    Quote Quote  
  20. Originally Posted by VoodooFX View Post
    Originally Posted by jagabo View Post
    MaskHS
    Is there an easy way of getting Hue/Sat values from RGB/YUV color value?
    I usually crop the frame down to the area of interest then use Histogram(mode="color2"):
    Code:
    ImageSource("gtyq1Vs.jpeg", start=0, end=23, fps=23.976) 
    ConvertToYV24(matrix="rec709")
    Crop(20,1000,-1390,-16)
    Histogram(mode="color2")
    Image
    [Attachment 65113 - Click to enlarge]


    Then I estimate the hue and saturation values knowing:

    Hue is the angle around the circle, Saturation is the distance from the center.

    Then I fine tune the variables to get the mask I want:

    Code:
    ImageSource("gtyq1Vs.jpeg", start=0, end=23, fps=23.976) 
    ConvertToYV24(matrix="rec709")
    Crop(20,1000,-1390,-16)
    MaskHS(StartHue=140, EndHue=170, MinSat=20, MaxSat=80)
    Image
    [Attachment 65114 - Click to enlarge]


    Then massage the mask with mt_expand(), mt_inpand(), Blur(), etc. Interleaving the image and mask, or overlaying the mask onto the image.

    Code:
    ImageSource("gtyq1Vs.jpeg", start=0, end=23, fps=23.976) 
    ConvertToYV24(matrix="rec709")
    Crop(20,1000,-1390,-16)
    hsm = MaskHS(StartHue=140, EndHue=170, MinSat=20, MaxSat=80)
    Overlay(last, hsm.Invert(), mask=hsm)
    Image
    [Attachment 65115 - Click to enlarge]


    Originally Posted by VoodooFX View Post
    Btw, your posted script didn't produce same result as in screenshot.
    Probably a color format/matrix issue. I only had the one PNG image (the before image from post #12) to use as a source and converted it to YV24 assuming rec.709 colors before MaskHS().
    Last edited by jagabo; 30th May 2022 at 17:50.
    Quote Quote  
  21. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    Not without re-ecoding audio, re-encoding degrades quality, and there is no reason to do that as you don't edit audio, so muxing in an original audio later is the right way to do this.
    Well actually the sound quality is already quite bad, because the camera was in a woterproof housing. But maybe it could be helpfull to match soundtracks of orriginal files as having a reference point. Is there a way to try out, to get the actual sound encoded into the video?

    Use MKVToolNix to mux in ["merge"] audio from a original file with new encoded video.
    You were refering to this. can I alternatively encode a video (to remove the timestamp) and after use the orriginal video with this program to merge the sound to the newly created video. And save it as newly encoded videopart, without timestamp but with the sound of the orriginal file?

    Resolution, framerate should be same. CRF setting adjust quality, CRF in the range of 19 - 21 should produce good quality [lower CRF = more quality, but bigger files], 17 - 19 range produce very good quality, make two encodes with different CRF, compare, if you don't see a difference then use higher.
    I was looking for a way to try and play around with this. There was no vallue of this in the script and I could not find anny settings so far in ffmpeg. So I asume it uses a standard vallue? Can I adjust this stard vallue?

    Some search on the internet teached me that adding "-crf 17" to the command applies this setting. In my case:
    Code:
    ffmpeg -i pachacamac.avs -crf 17 pachacamac.mp4
    You probably didn't include the audio in your AviSynth script.

    Code:
    a = LWLibAvAudioSource("D:\Pachacamac E.MP4") # get audio
    v = LWLibAvVideoSource("D:\Pachacamac E.MP4") # get video
    AudioDub(v,a) # join audio and video into a single stream
    I've tried this. I've included this into the script, maybe I did something wrong, but it didn't gave me anny sound so far.
    Quote Quote  
  22. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Here is updated script:

    v = LWLibAvVideoSource("D:\testtt\Pachacamac E.mp4")
    xEnd = v.Trim(v.FrameCount,-1).loop(60)
    xStart = v.Trim(0,-1).loop(60)

    xStart + v + xEnd
    InpaintDelogo(Loc="4,990,-1380,-4", DynMask=3, DynTune=140, DynColor=$FFB900, DynColorTol=50, Dyn3Seq=52, DynInflate=3)
    Trim(60, FrameCount - 61)
    Originally Posted by Rockel83 View Post
    You were refering to this. can I alternatively encode a video (to remove the timestamp) and after use the orriginal video with this program to merge the sound to the newly created video. And save it as newly encoded videopart, without timestamp but with the sound of the orriginal file?
    That is exactly what MKVToolNix does, but looks like you can do audio without re-encoding like jagabo wrote there.

    Originally Posted by jagabo View Post
    Then I estimate the hue and saturation values knowing...
    That's too hardcore for the newbies, they need ~one click solution to everything...
    Quote Quote  
  23. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    Originally Posted by jagabo View Post
    Originally Posted by Rockel83 View Post
    But isn't there a way to get the audio in the encoded video right away?
    ffmpeg can mux the original audio while compressing the video from your script. Assuming a source mp4 video has the same base name as the AVS script and is in the same folder, for example

    My Video.mp4
    My Video.AVS

    Code:
    "G:\program files\ffmpeg64\bin\ffmpeg.exe" -y ^
        -i "%~dpnx1" ^
        -i "%~dpn1.mp4" ^
        -map 0:v -map 1:a ^
        -c:v libx264 -preset slow -crf 18 -g 50 ^
        -acodec aac -b:a 192K ^
        -colorspace bt709 -color_range tv ^
        "%~dpn1.avc+aac.mp4"
    pause
    -i "%~dpnx1" imports the avs script
    -i "%~dpn1.mp4" imports the audio and video from the mp4 file
    -map 0:v -map 1:a keeps the video from the first import, the audio from the second import
    Thanks! I've actually read it a couple of times and stared to it some time. But I can't figure out how to use this.

    It's also a script right? But it looks verry diffrent from the script I got from VoodooFX. Missing the InpaintDelogo, DynMask, DynTune aspects etc.

    It looks more like the "drag/drop batch file" you've mentioned in a previous post.

    That will get you a mp4 file with avc video and aac audio. A simple drag/drop batch file:

    Code:
    Start /b /low "ffmpeg" "G:\program files\ffmpeg64\bin\ffmpeg.exe" ^
        -i %1 ^
        -c:v libx264 -preset slow -crf 18 -g 50 ^
        -profile:v high -level:v 4.2 -colorspace bt709 -color_range tv ^
        -acodec aac  -b:a 192K ^
        "%~dpn1.avc.mkv"
    pause
    But I didn't understood how to use it yet.

    Originally Posted by jagabo View Post
    Originally Posted by VoodooFX View Post
    Originally Posted by jagabo View Post
    MaskHS
    Is there an easy way of getting Hue/Sat values from RGB/YUV color value?
    I usually crop the frame down to the area of interest then use Histogram(mode="color2"):
    Code:
    ImageSource("gtyq1Vs.jpeg", start=0, end=23, fps=23.976) 
    ConvertToYV24(matrix="rec709")
    Crop(20,1000,-1390,-16)
    Histogram(mode="color2")
    Image
    [Attachment 65113 - Click to enlarge]


    Then I estimate the hue and saturation values knowing:

    Hue is the angle around the circle, Saturation is the distance from the center.

    Then I fine tune the variables to get the mask I want:

    Code:
    ImageSource("gtyq1Vs.jpeg", start=0, end=23, fps=23.976) 
    ConvertToYV24(matrix="rec709")
    Crop(20,1000,-1390,-16)
    MaskHS(StartHue=140, EndHue=170, MinSat=20, MaxSat=80)
    Image
    [Attachment 65114 - Click to enlarge]


    Then massage the mask with mt_expand(), mt_inpand(), Blur(), etc. Interleaving the image and mask, or overlaying the mask onto the image.

    Code:
    ImageSource("gtyq1Vs.jpeg", start=0, end=23, fps=23.976) 
    ConvertToYV24(matrix="rec709")
    Crop(20,1000,-1390,-16)
    hsm = MaskHS(StartHue=140, EndHue=170, MinSat=20, MaxSat=80)
    Overlay(last, hsm.Invert(), mask=hsm)
    Image
    [Attachment 65115 - Click to enlarge]


    Originally Posted by VoodooFX View Post
    Btw, your posted script didn't produce same result as in screenshot.
    Probably a color format/matrix issue. I only had the one PNG image (the before image from post #12) to use as a source and converted it to YV24 assuming rec.709 colors before MaskHS().
    This looks interesting too. Could I somehow try this mask on my videos to see the results too? I'm verry curious to it
    Quote Quote  
  24. Member Rockel83's Avatar
    Join Date
    Apr 2022
    Location
    Holland
    Search PM
    Originally Posted by VoodooFX View Post

    Looks like you can do audio without re-encoding like jagabo wrote there.
    Thanks! I need to figure out how to use this. But things are geting quite complex and confusing now

    Originally Posted by VoodooFX View Post
    That's too hardcore for the newbies, they need ~one click solution to everything...
    I'm sorry. I feel verry clumpsy not seeming to understanding a lot of things you guys write down here. I'm trying to understand but it's clear I'm missing some basic knowledge here.

    I appreciate all your help and effort btw! (both of you)
    Quote Quote  
  25. Originally Posted by Rockel83 View Post
    Originally Posted by jagabo View Post
    MaskHS().
    This looks interesting too. Could I somehow try this mask on my videos to see the results too? I'm verry curious to it
    I don't know InpaintDelogo() and whether it can take a user supplied video as the mask. VoodooFX should know...
    Quote Quote  
  26. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    @jagabo
    In some post above I explained to him how to supply an external mask to InpaintDelogo.
    Btw, your last batch script example re-encodes audio.

    @Rockel83
    That mask is just an example, it's not ready for you to use, and it can't offer anything better for InpaintDelogo.

    Open Notepad and paste there a batch script, save it to Desktop as "AutoEncode.bat", now you can drag and drop your video/avs file[s] on it to do auto encode.
    Quote Quote  
  27. Originally Posted by VoodooFX View Post
    Btw, your last batch script example re-encodes audio.
    Oops, you're right. I copied and pasted and forgot to change to "-acodec copy":

    Code:
    "G:\program files\ffmpeg64\bin\ffmpeg.exe" -y ^
        -i "%~dpnx1" ^
        -i "%~dpn1.mp4" ^
        -map 0:v -map 1:a ^
        -c:v libx264 -preset slow -crf 18 -g 50 ^
        -acodec copy ^
        -colorspace bt709 -color_range tv ^
        "%~dpn1.avc+aac.mp4"
    pause
    Quote Quote  
  28. Originally Posted by Rockel83 View Post
    Originally Posted by jagabo View Post
    Originally Posted by Rockel83 View Post
    But isn't there a way to get the audio in the encoded video right away?
    ffmpeg can mux the original audio while compressing the video from your script. Assuming a source mp4 video has the same base name as the AVS script and is in the same folder, for example

    My Video.mp4
    My Video.AVS

    Code:
    "G:\program files\ffmpeg64\bin\ffmpeg.exe" -y ^
        -i "%~dpnx1" ^
        -i "%~dpn1.mp4" ^
        -map 0:v -map 1:a ^
        -c:v libx264 -preset slow -crf 18 -g 50 ^
        -acodec copy ^
        -colorspace bt709 -color_range tv ^
        "%~dpn1.avc+aac.mp4"
    pause
    -i "%~dpnx1" imports the avs script
    -i "%~dpn1.mp4" imports the audio and video from the mp4 file
    -map 0:v -map 1:a keeps the video from the first import, the audio from the second import
    Thanks! I've actually read it a couple of times and stared to it some time. But I can't figure out how to use this.
    Put it in a batch file. You will have to change the path to ffmpeg.exe. Start Notepad, copy the text from the post, paste it into Notepad, Save it as ffEncode.BAT -- be sure to specify the .BAT extension when you save. Then drag/drop an AVS script onto the batch file.

    Note that VoodooFX pointed out an error in the original post (it was reencoding the audio). I fixed the error in the above code segment. It now copies the audio from the source mp4 file to the destination mp4 file.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!