VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    I have lots of short clips that I encode but without the audio because the encoders I use (hevc via x265) does not include a muxer to encode the audio along with the video. The only way I can add the audio into the hevc encoded video is to first encode the video and then extract the audio through virtualdub, then compress it, and then mux the video and audio with ffmpeg. But there are too many steps involved in some of that. I want to just get it from the avisynth script since that is what I am always in at the time.

    I was wondering how can this be done, hopefully through a command line method.
    Quote Quote  
  2. You can't really "extract" audio through avisynth, because it frameserves uncompressed audio and video. So you would be decompressing the original audio, then re-encoding it with something else, unless you planned to keep uncompressed audio

    Since you were using ffmpeg, why not use that to stream copy the audio in the first place ? or if it's not a compatible audio format in your container, you can use it to re-encode.
    Quote Quote  
  3. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Let me explain my situation.

    I spend most of my time in avisnth scripts, encoding different sections of analog captures. I am mainly in the trim() and selectevery() sections of the avs script.

    Below is just a short snippet of how my script looks. I have dozens of lines like these that I run through different encodes and sometimes different encoders, ie avc and mpeg.

    Code:
    # trim(  14046,0000+00000).trim(00000,00000).separateFields().selectevery( 05, 0,1,2,3).weave( ).trim( 0000, 0).trim( 0001, 0000).trim( 0, 005448) # v = "c:\cap\cap.PAN.PV-S4670.to.HVR950Q.5thelement.20161005wed.svideo..01.avi"
    # trim(  14046,0000+00000).trim(00000,00000).separateFields().selectevery( 05, 0,1,2,3).weave( ).trim( 0000, 0).trim( 0001, 0000).trim( 0, 000773) # v = "c:\cap\cap.PAN.PV-S4670.to.HVR950Q.5thelement.20161005wed.svideo..01.avi"
    # trim(  00005,0000+00000).trim(00000,00000).separateFields().selectevery( 05, 0,1,2,3).weave( ).trim( 0000, 0).trim( 0002, 0000).trim( 0, 005448) # v = "c:\cap\cap.PAN.AG-1980.to.HVR950Q.5thelement.20161005wed.svideo.01.avi" # audio delay -6000 
      trim( 108681,0000+00000).trim(00000,00000).separateFields().selectevery( 05, 0,1,2,3).weave( ).trim( 0000, 0).trim( 0004, 0000).trim( 0, 003740) # v = "g:\caps\cap.AG-5710.to.D-R4.to.HVR-950Q.to.UT.5thelement.2.avi" # no audio delay
    Now, I have a custom gui4hevc app that I've been working on over the last few years. And I would like to build into it the means to finally extract the audio from the avs script, convert it, then mux it when the video finishes encoding in the gui. I have the scripts already set up since that is what I feed into gui4hevc. Encoding the captures to hevc w/out audio is fine. I am mostly learning x265 and encoding quality ideas through the gui. But I'd like to now include the audio as well.
    Quote Quote  
  4. The easiest is still ffmpeg, which has avisynth support . You need to match versions (32bit avisynth requires 32bit ffmpeg binary) . You could even encode everything audio & video and mux at once with ffmpeg libx265 if you wanted to
    Quote Quote  
  5. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    But I use avisource() for my avi's.

    I capture a lot of vhs content through various vcrs. And some directv too. So, I have a system, though messy, but this is how I work and it has been working for me for many years.

    Here is a snippet (cleaned up for this discussion) of how I work with video, because the videos are telecine and I need to perform IVTC on them.


    Code:
       v = "g:\caps\20161017.video.movie_PV-4662.to.D-R4.to.HVR-950Q.to.UT.1.avi"
    #  v = "c:\cap\test1.directstream.avi"
    #  v = "g:\caps\cap.AG-5710.to.D-R4.to.HVR-950Q.to.UT.5thelement.2.avi"
    #  v = "f:\caps\cap.RCA.VR-618HF.to.HVR-950Q.to.UT.dr.oz.operah.4.avi"
    #  v = "c:\cap\cap.PAN.PV-4662.to.HVR950Q.5thelement.02.D-R4.02.avi"
    #  v = "c:\cap\cap.PAN.PV-4662.to.HVR950Q.5thelement.01.firsttime.avi" # first time i test ran this vcr 
    #  m = "C:\Users\dell\Documents\DOWNLOADS\00\Trailer Test Source.mkv"  # m for mkv files
       
      AVIsource( v ) # UT codec 
    
      separateFields( ).selectevery(2, 1,0).weave                          # required for my capture equipment and ITVC methods below 
    
    Script name: movie.avs
    
    # trim(  14046,0000+00000).trim(00000,00000).separateFields().selectevery( 05, 0,1,2,3).weave( ).trim( 0000, 0).trim( 0001, 0000).trim( 0, 005448) # v = "c:\cap\cap.PAN.PV-S4670.to.HVR950Q.5thelement.20161005wed.svideo..01.avi"
    # trim(  14046,0000+00000).trim(00000,00000).separateFields().selectevery( 05, 0,1,2,3).weave( ).trim( 0000, 0).trim( 0001, 0000).trim( 0, 000773) # v = "c:\cap\cap.PAN.PV-S4670.to.HVR950Q.5thelement.20161005wed.svideo..01.avi"
    # trim(  00005,0000+00000).trim(00000,00000).separateFields().selectevery( 05, 0,1,2,3).weave( ).trim( 0000, 0).trim( 0002, 0000).trim( 0, 005448) # v = "c:\cap\cap.PAN.AG-1980.to.HVR950Q.5thelement.20161005wed.svideo.01.avi" # audio delay -6000
      trim( 108681,0000+00000).trim(00000,00000).separateFields().selectevery( 05, 0,1,2,3).weave( ).trim( 0000, 0).trim( 0004, 0000).trim( 0, 003740) # v = "g:\caps\cap.AG-5710.to.D-R4.to.HVR-950Q.to.UT.5thelement.2.avi" # no audio delay
    
      ConvertToYUY2( interlaced=false )
      ConvertToYV12                                                        # with ..ToYUY2 because levels are borqed when suing with x265.exe and mpeg2enc encoders.
    The above is a short list out of the many files I capture and list in the original avs script. I often will return to a particular capture file and re-encode it with different parameters or other reason. So, I REMark and un-REMark files for that process. I do a lot of clip analyzing, so the above layout is my method that works for me.

    But, I don't see how I can use ffmpeg on the avs script above, unless I'm missing something to understand. I can be slow at these things, sometimes. Well, I got to get some sleep. Thanks for your help.
    Quote Quote  
  6. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Ok, I found a method. How blind was I. I thought ffmpeg didn't do avs scripts. Oh well.

    Here is the parameter scripts I used to extract the audio, in various formats. All work except .ogg, it encodes to video and audio.

    I believe this is pretty much what I was looking for, and simple

    Code:
    ffmpeg -i  "c:\tools\movie.avs" -acodec libmp3lame -y c:\videos\audio.mp3
    ffmpeg -i  "c:\tools\movie.avs" -acodec libvorbis -y c:\videos\audio.ogg
    ffmpeg -i  "c:\tools\movie.avs" -acodec libfaac -y c:\videos\audio.aac
    ffmpeg -i  "c:\tools\movie.avs" -acodec ac3 -y c:\videos\audio.ac3
    Quote Quote  
  7. Since you were complaining of too many steps... one step is probably fewer and definitely faster. You can combine the audio with everything else in the ffmpeg commandline (since you were using ffmpeg to mux anyways). You can even use libx265 in the same command. The only reason I can think of that you might not want to do that is if you were using some features not supported by ffmpeg libx265, only the x265 binary
    Quote Quote  
  8. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Since you were complaining of too many steps... one step is probably fewer and definitely faster. You can combine the audio with everything else in the ffmpeg commandline (since you were using ffmpeg to mux anyways). You can even use libx265 in the same command. The only reason I can think of that you might not want to do that is if you were using some features not supported by ffmpeg libx265, only the x265 binary
    The avs script is already built. It has the video and audio, as well as the cut sections I want to encode, whether in my gui4hevc or another app all-together. Obviously, I am using virtualdub in order to get the cut sections (the frame numbers) that I want to encode. I write down the IN and OUT frame numbers and add them to the avs trim(in,out) function in order ivtc that sequence, and then finally feed that into the gui. Using ffmpeg, the steps involved is still quicker than virtualdub even when I'm in it to find the sequence(s) that I want to encode. Eventually, I will have a cleaner more appealing looking gui and possibly release it. Its a mess at the moment from all the debugging and trial and error that goes into developing windows applications. Anyway. I'm just so busy doing many things plus work, etc., there's not enough time to really sit down and focus on just that project.
    Quote Quote  



Similar Threads

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