VideoHelp Forum
+ Reply to Thread
Results 1 to 23 of 23
Thread
  1. HI cats

    please consider this 2 commandline
    Code:
    ffmpeg.exe -i InputVideo.avs -i InputAudio.MP4 -map 0:v -map 1:a -vcodec mjpeg -shortest -af apad -c:a pcm_s16le output.AVI 
    
    ffmpeg.exe -i output.avi -acodec copy output.wav
    my target is achieving the output.wav : I don't want the the video part

    inputVideo.avs is a audio/video file
    inputAudio.MP4 is a audio/video file

    This 2 commandlines "fit" the final audio duration as the video duration: the target (output.wav) is only the audio part of the InputAudio.MP4 that have a duration, a lenght, of the inputVideo.avs (with silence, if necessary)

    FFMPEG don't allow me to encode directly the output.wav in the first commandline so I'm force to generate a video embedded in the avi - in mjpeg - which then it is processed in the second line but trashed

    So I wonder if exist a way to do a minimal encoding [of the output.avi] so that the video part become reduced at the minimum to avoiding overload of cpu and an unnecessary use of disk space

    Thanks

    ps: if there is a way to generate a black video or null video in the output.avi OR if there is a way to encode directly the output.wav in a unique commandline I would be a happy cat
    Last edited by marcorocchini; 18th Mar 2016 at 03:07.
    Quote Quote  
  2. ah ok thanks but concretely what I can use in my commandline? how have a do? ^^
    Quote Quote  
  3. Originally Posted by marcorocchini View Post
    ah ok thanks but concretely what I can use in my commandline? how have a do? ^^
    Oh, examples are there but i'm currently quite busy and i can't provide working solution - if you will wait few days then i should be less busy.

    But from my perspective approach like:
    - create multiple outputs (independent video and audio)
    - copy video to null
    - output audio to wav
    Quote Quote  
  4. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    If you only want wav, that means you only want audio (as wav is audio-only format). If you only want audio, why are you including video in you input stream selection?

    Scott
    Quote Quote  
  5. Member
    Join Date
    Aug 2014
    Location
    India
    Search Comp PM
    Try

    Code:
    ffmpeg.exe -i InputVideo.avs -i InputAudio.MP4 -map 0:v -map 1:a -vcodec rawvideo -shortest -af apad -c:a pcm_s16le -f tee "[f=null]-|[select=a]output.wav"
    Since you don't want video, avoid invoking an actual video encoder, to save time.
    Quote Quote  
  6. Originally Posted by mulvya View Post
    Try

    Code:
    ffmpeg.exe -i InputVideo.avs -i InputAudio.MP4 -map 0:v -map 1:a -vcodec rawvideo -shortest -af apad -c:a pcm_s16le -f tee "[f=null]-|[select=a]output.wav"
    Since you don't want video, avoid invoking an actual video encoder, to save time.
    Oh WOWOW!!

    it does work in a unique commanline

    Click image for larger version

Name:	IuyabHQ.jpg
Views:	151
Size:	276.6 KB
ID:	36219
    Quote Quote  
  7. Originally Posted by mulvya View Post
    Try

    Code:
    ffmpeg.exe -i InputVideo.avs -i InputAudio.MP4 -map 0:v -map 1:a -vcodec rawvideo -shortest -af apad -c:a pcm_s16le -f tee "[f=null]-|[select=a]output.wav"
    Since you don't want video, avoid invoking an actual video encoder, to save time.

    mulvya kindly I wonder: to save time, to don't encode nothing, can I apply a sort of -vf scale [to] 1x1 pixel or something that reduce to a minimal part the video "encoding" process? thank you
    Quote Quote  
  8. Member
    Join Date
    Aug 2014
    Location
    India
    Search Comp PM
    Sure. Add -vf "scale=1x1"
    Quote Quote  
  9. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Again, map only the audio stream!

    (plus, most encoders are terribly inefficient at the very bottom end of their scale, to say nothing of the very strong possibility that some encoders cannot/wouldn't allow 1x1 sizes).

    Maybe you're not being clear what you really are wanting to do.

    Scott
    Quote Quote  
  10. He wants to pad/shorten the audio to the length of the video so he cannot not map it even if he does not need it.
    Quote Quote  
  11. Member
    Join Date
    Feb 2004
    Location
    United States
    Search Comp PM
    What happens if you use -vn instead of -vcodec?
    PB
    Quote Quote  
  12. Member
    Join Date
    Aug 2014
    Location
    India
    Search Comp PM
    Actually, better than scale would be crop i.e. -vf crop=1:1. And rawvideo is not an encoder. It's, depending on the output pixel format, outputting uncompressed planar or interleaved pixmaps. With crop feeding it 1 pixel, this should proceed even faster.
    Quote Quote  
  13. Originally Posted by autodidact View Post
    What happens if you use -vn instead of -vcodec?
    it don't work cat
    Quote Quote  
  14. Originally Posted by Cornucopia View Post
    Again, map only the audio stream!

    (plus, most encoders are terribly inefficient at the very bottom end of their scale, to say nothing of the very strong possibility that some encoders cannot/wouldn't allow 1x1 sizes).

    Maybe you're not being clear what you really are wanting to do.

    Scott
    oh
    Click image for larger version

Name:	cat57e.jpg
Views:	220
Size:	30.3 KB
ID:	36220

    Originally Posted by sneaker View Post
    He wants to pad/shorten the audio to the length of the video so he cannot not map it even if he does not need it.
    Quote Quote  
  15. Code:
    :Make_File_Other <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    color d
    
    Set "AudioVolume=1.0"
    
    cls
    echo *** ____ MP4gopro ____ varie risoluzioni ma a 50fps a .AVS HD 1920 x 1080 ***
    echo *** l'eventuale filtro di resize da applicare può essere solo IResize e non LanczosResize  ***
    cls
    
            if exist "%~n1_HDavs.avs" del "%~n1_HDavs.avs"
    
    
            echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
            echo ³                                      ³
            echo ³              others                  ³
            echo ³                                      ³
            echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
            echo.
    
            if not "%FPSforVirtualdub%"=="0" (set /a "newFPSforVirtualdub=%FPSforVirtualdub%-1") else (set "newFPSforVirtualdub=0")
    
            rem Set "LancZosFilter=0"
            rem cscript //NOLOGO   //T:2 "v:\automazioneclip\core\CHOICE.vbs" /C:yn /T:y,2 " PREMI y PER INDURIRE I CONTORNI "
            rem if %errorlevel% == 0 echo prompt timed out!      :: this is the default!
            rem if %errorlevel% == 1 Set "LancZosFilter=1"
    
            rem *** TRY to test if input file have or not audio ***
            if exist "%WorkFolder%\TESTonly.wav" del "%WorkFolder%\TESTonly.wav"
            v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -ss 00:00:00 -t 00:00:10 -filter_complex "[0:1] volume=%AudioVolume%" "%WorkFolder%\TESTonly.wav"
            for %%v in ("TESTonly.wav") do (
    		if %%~zv LSS 128 (			
                    del "%WorkFolder%\TESTonly.wav"
    		)
    	)  
    
            Set "TokenS=0"
            Set "audioInsideFileExist=0"
            if exist "%WorkFolder%\TESTonly.wav" set "audioInsideFileExist=1"
            del "%WorkFolder%\TESTonly.wav"
            IF "%audioInsideFileExist%"=="1" set "AudioFile=%4"
            if not "%FPSforVirtualdub%"=="0" (set /a "newFPSforVirtualdub=%FPSforVirtualdub%-1") else (set "newFPSforVirtualdub=0")
    
            echo Blankclip^(length=%newFPSforVirtualdub%, fps=50, stereo=true, audio_rate=48000^)>"%~dp1%~n1_blank.avs"
            
            IF NOT "%audioInsideFileExist%"=="1" (v:\automazioneclip\core\ffmpeg.exe  -y -i "%~dp1%~n1_blank.avs" -filter_complex "[0:1] volume=1.0" -c:a pcm_s16le "%~n1_blank.wav")
            IF NOT "%audioInsideFileExist%"=="1" set "AudioFile=%~n1_blank.wav"
            echo PROCESSING %4
     
            rem v:\automazioneclip\core\ffmpeg.exe  -n -i %4 -filter_complex "[0:1] [0:2] amerge,volume=%AudioVolume%" -c:a pcm_s16le "%DestFolder%\%~n1_HD.wav"
            rem v:\automazioneclip\core\ffmpeg.exe  -n -i %4 -filter_complex "[0:3] [0:4] amerge,volume=%AudioVolume%" -c:a pcm_s16le "%DestFolder%\%~n1_HDch3ch4.wav"
           
            
            rem ***Make The .avs Script File ***
            echo SetMemoryMax^(%SetMemoryMaxValue%^)>"%~n1_HDavs.avs"
            echo Import^("v:\automazioneclip\avisynth\plugins\IResize.avsi"^)>>"%~n1_HDavs.avs"
            echo LoadPlugin^("v:\automazioneclip\avisynth\plugins\LSMASHSource.dll"^)>>"%~n1_HDavs.avs"
            echo LoadCPlugin("v:\automazioneclip\core\yadif.dll")>>"%~n1_HDavs.avs"
    
    echo isMP4 assume %isMP4%
    echo Ch_Sub422 assume %Ch_Sub422%
    echo progressive assume %PROGRESSIVE%
    echo fullHD assume %fullHD% 
    echo IMXorDCAM assume %IMXorDCAM%
    
            IF "%isMP4%"=="1" echo LSMASHVideoSource^(%4^)>>"%~n1_HDavs.avs"
            IF NOT "%isMP4%"=="1" echo LWLibavVideoSource^(%4^)>>"%~n1_HDavs.avs"
            if NOT "%Ch_Sub422%"=="yes" if "%PROGRESSIVE%"=="1" echo ConvertToYUY2^(interlaced=false^)>>"%~n1_HDavs.avs"
            if NOT "%Ch_Sub422%"=="yes" if NOT "%PROGRESSIVE%"=="1" echo ConvertToYUY2^(interlaced=true^)>>"%~n1_HDavs.avs"
            if "%IMXorDCAM%"=="yes" echo colorMatrix^(mode="Rec.601->Rec.709"^)>>"%~n1_HDavs.avs"
            if NOT "%fullHD%"=="1" echo IResize^(1920,1080^)>>"%~n1_HDavs.avs"       
            
            echo ### ATTENZIONE l'uso dei filtri ColorYUV rende difficile il playback in realtime ###>>"%~n1_HDavs.avs"
            echo #ColorYUV^(levels="PC->TV"^)>>"%~n1_HDavs.avs"
            echo #ColorYUV^(gamma_y=-7, gamma_u=-7, gamma_v=-7^)>>"%~n1_HDavs.avs"
            echo #colorMatrix^(mode="Rec.709->Rec.601"^)>>"%~n1_HDavs.avs"
    
            if NOT "%fps25%"=="yes" if NOT "%fps50%"=="yes" echo SmoothFPS2^(50000,1000^)>>"%~n1_HDavs.avs"
            if NOT "%fps25%"=="yes" if NOT "%fps50%"=="yes" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HDavs.avs"
            if "%fps50%"=="yes" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HDavs.avs"
    
            IF "%visualDeinterlace%"=="1" echo bob^(^).SelectEven^(^)>>"%~n1_HDavs.avs"
            rem echo AssumeFPS^(25^)>>"%~n1_HDavs.avs"
    
                
           rem  v:\automazioneclip\core\ffmpeg.exe  -n -i "%~n1_HDavs.avs" -filter_complex "[0:1] volume=%AudioVolume%" -c:a pcm_s16le "%~dp1%~n1_HDavs.wav" 
    
           rem v:\automazioneclip\core\ffmpeg.exe -n -i "%~n1_HDavs.avs" -i %4 -af "pan=stereo:c0=c0:c1=c1,volume=%AudioVolume%" -map 0:v -map 1:a -vcodec mjpeg -shortest -af apad -c:a pcm_s16le -ar 48000 "%~dp1%~n1_HDavs.avi" 
           rem v:\automazioneclip\core\ffmpeg.exe -n -i "%~dp1%~n1_HDavs.avi" -acodec copy "%~dp1%~n1_HDavs.wav" 
    
    
    
           v:\automazioneclip\core\ffmpeg.exe -n -i "%~n1_HDavs.avs" -i %4 -vf crop=2:2 -af "pan=stereo:c0=c0:c1=c1,volume=%AudioVolume%" -map 0:v -map 1:a -vcodec rawvideo -shortest -af apad -c:a pcm_s16le -ar 48000 -f tee "[f=null]-|[select=a]%~dp1%~n1_HDavs.avi"
           
           del "%~dp1%~n1_blank.wav"
           del "%~dp1%~n1_blank.avs"
           rem del "%~n1_HDavs.avs"
    
            if exist "%~dp1tempNaming.txt" del "%~dp1tempNaming.txt"
            echo %~dp1%~n1_HDavs>tempNaming.txt
            v:\automazioneclip\system\fart.exe "%~dp1tempNaming.txt" : _
            v:\automazioneclip\system\fart.exe "%~dp1tempNaming.txt" \ _
            set /p newPath=<"%~dp1tempNaming.txt"
            if exist "%~n1_HDavs_%newPath%.avs" del "%~n1_HDavs_%newPath%.avs" 
            ren "%~n1_HDavs.avs" "%~n1_HDavs_%newPath%.avs"
            pfm unmount "%~dp1%~n1_HDavs_%newPath%.avs"
            pfm mount "%~dp1%~n1_HDavs_%newPath%.avs"
            IF NOT "%windowsXP%"=="1" findstr /c:"%~dp1%~n1_HDavs_%newPath%.avs" "C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\AVSavvio.bat"
            IF NOT "%windowsXP%"=="1" IF ERRORLEVEL 1 (echo pfm mount "%~dp1%~n1_HDavs_%newPath%.avs">>"C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\AVSavvio.bat")  
            IF "%windowsXP%"=="1" findstr /c:"%~dp1%~n1_HDavs_%newPath%.avs" "C:\Documents and Settings\Administrator\Menu Avvio\Programmi\Esecuzione automatica\AVSavvio.bat"
            IF "%windowsXP%"=="1" IF ERRORLEVEL 1 (echo pfm mount "%~dp1%~n1_HDavs_%newPath%.avs">>"C:\Documents and Settings\Administrator\Menu Avvio\Programmi\Esecuzione automatica\AVSavvio.bat")
            for /f delims^=^" %%a in ('pfm flush "%~dp1%~n1_HDavs_%newPath%.avs"') do set "flushed1=%%a"
            set "flushed=%flushed1%\%~n1_HDavs_%newPath%.avi"
            if exist "%~dp1%~n1_HDavs.avi" del "%~dp1%~n1_HDavs.avi"
            v:\automazioneclip\core\mklink.exe /s "%~dp1%~n1_HDavs.avi" "%flushed%"
            if exist "%~dp1tempNaming.txt" del "%~dp1tempNaming.txt"
          
           goto :eof
    thank you cat !

    Name:  thankcat.jpg
Views: 1011
Size:  18.5 KB
    Quote Quote  
  16. Member
    Join Date
    Aug 2014
    Location
    India
    Search Comp PM
    In the highlighted line, the apad has no effect. You should have only one filterchain i.e.

    -af "pan=stereo:c0=c0:c1=c1,volume=%AudioVolume%,a pad"

    (Anyway, what's the point of the pan? You aren't changing anything)
    Quote Quote  
  17. ah thanks :=)
    Quote Quote  
  18. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Now it becomes clear!

    You could do a 2-step process: Trim (w/Vid) - using uncompressed cropped small (but keep the framerate for finer time resolution), then Map-only-audio.

    Scott
    Quote Quote  
  19. Originally Posted by mulvya View Post
    Try

    Code:
    ffmpeg.exe -i InputVideo.avs -i InputAudio.MP4 -map 0:v -map 1:a -vcodec rawvideo -shortest -af apad -c:a pcm_s16le -f tee "[f=null]-|[select=a]output.wav"
    Since you don't want video, avoid invoking an actual video encoder, to save time.

    mulvya for kindness I ask you this:

    now I would like generate the video part (of the .avs input source) into a video.mkv output file, and a audio.mkv (or .wav) in a second file. Can I do in a unique commanline? thanks!
    Quote Quote  
  20. Member
    Join Date
    Aug 2014
    Location
    India
    Search Comp PM
    Code:
    ffmpeg.exe -i InputVideo.avs -i InputAudio.MP4 -map 0:v -map 1:a -vcodec libx264 -shortest -af apad -c:a pcm_s16le -f tee "[select=v]video.mkv|[select=a]output.wav"
    Quote Quote  
  21. oh thank you cat

    Click image for larger version

Name:	wowcat.jpg
Views:	219
Size:	105.3 KB
ID:	36248
    Quote Quote  
  22. ---
    Last edited by marcorocchini; 2nd Apr 2016 at 16:48.
    Quote Quote  



Similar Threads

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