someone on here once gave me a script by ffmpeg to make movie formats louder like .avi, .mkv, mp4 it was like this below. but dont seem to work no more when i drop a movie onto the audio.bat file
the folder was called ffmpeg-20160412-git-196cfc2-win64-static
inside are these folders
and inside the bin folder are these
and this is what audio.bat says
Code:@ffmpeg -i %1 -c:v copy -c:a ac3 -b:a 192k -af "aformat=sample_fmts=fltp,highpass=f=5,dynaudnorm=m=100.0:f=500:p=0.5:b=0:s=5.0,aresample=resampler=soxr:osr=48000:dither_method=0" "%~n1_dyn%~x1"
could anyone here help me on this please it would be most appreciated
+ Reply to Thread
Results 1 to 26 of 26
-
Last edited by loa909; 18th Nov 2017 at 09:06.
-
Add the command "pause" to your batch file so you can read any errors that are thrown.
Code:@ffmpeg -i %1 -c:v copy -c:a ac3 -b:a 192k -af "aformat=sample_fmts=fltp,highpass=f=5,dynaudnorm=m=100.0:f=500:p=0.5:b=0:s=5.0,aresample=resampler=soxr:osr=48000:dither_method=0" "%~n1_dyn%~x1" pause
-
-
At first locate where ffmpeg.exe is present
second add location of ffmpeg.exe to path
Code:SET PATH=%PATH%;C:\folderwhereffmpeg.exeislocated
Code:@setlocal @set PATH=%PATH%;C:\folderwhereffmpeg.exeislocated @set filename=%1 @@ffmpeg.exe -i "%filename%" -c:v copy -c:a ac3 -b:a 192k -af "aformat=sample_fmts=fltp,pan=stereo|FL < FL+1.414FC+0.5BL+0.5SL+0.25LFE+0.125BR|FR < FR+1.414FC+0.5BR+0.5SR+0.25LFE+0.125BL,highpass=f=5,dynaudnorm=p=1/sqrt(2):m=100:s=20,aresample=resampler=soxr:osr=48000:dither_method=0" "%~n1_dyn%~x1" @endlocal @pause
(based on bitrate i assumed that this will be 2 channel (stereo) AC-3 - that's why downmixing is present). -
Thank you so much pandy its working again now I added your file and named it audio.bat this is what I have now
Code:@setlocal @set PATH=%PATH%;c:\ffmpeg-20160412-git-196cfc2-win64-static\bin\ @set filename=%1 @@ffmpeg.exe -i "%filename%" -c:v copy -c:a ac3 -b:a 192k -af "aformat=sample_fmts=fltp,pan=stereo|FL < FL+1.414FC+0.5BL+0.5SL+0.25LFE+0.125BR|FR < FR+1.414FC+0.5BR+0.5SR+0.25LFE+0.125BL,highpass=f=5,dynaudnorm=p=1/sqrt(2):m=100:s=20,aresample=resampler=soxr:osr=48000:dither_method=0" "%~n1_dyn%~x1" @endlocal @pause
will this accept .avi and also mkv too. I dont know too much on this ffmpeg thing. But I do also have one for removing logos
Code:"C:\ffmpeg-3.4-win64-static\bin\ffmpeg" -i %1 -vf delogo=x=70:y=292:w=146:h=46 -c:a aac -b:a 192k %1.delogo.mkv
and for ffplay
Code:"C:\ffmpeg-3.4-win64-static\bin\ffplay" -i %1 -vf delogo=x=70:y=292:w=146:h=46:show=1 pause
-
If you add -vn to script then it will accept every file known to ffmpeg - video will be ignored and audio processed as specified within audio filter (you may add -vn -sn -dn this will remove all video, subtitle and data from stream and as such audio only file will be created).
IMHO to simplify syntax you may replace :Code:"C:\ffmpeg-3.4-win64-static\bin\ffplay"
Code:@setlocal @set ffply= "C:\ffmpeg-3.4-win64-static\bin\ffplay.exe" @%ffply% -i "%1" -vf "delogo=x=70:y=292:w=146:h=46:show=1" @endlocal @pause
-
-
Glad to help.
For delogo seem you forgotten to specify video codec (as you processing video then it must be decompressed, video filtering applied and later compressed to something useful) - so you need to add all this video codec related mambo jumbo...
btw i would add extension exe to ffmpeg to avoid relying on command interpreter (so use ffmpeg.exe - this is only 4 characters more). -
-
Video codec or perhaps more accurate - video compression - same approach like for normalization of audio - at some point you need to tell ffmpeg what kind codec must be used for processed data. In case audio you use ac3 codec with bitrate 192kbps, similar if you process video data at some point you need to specify video codec (compression) for example you can compress video with h.264 video codec (libx264).
Bellow typical example for ffmpeg where audio and video is processed - your delogo filter should be placed as variable vproc.
Code:@setlocal @set vq=24 @set aq=5 @SET x264opts="crf=%vq%:level=4.0:qpmin=12:vbv_maxrate=19999:vbv_bufsize=9999:ref=3:bframes=3:rc-lookahead=30:cabac=1:interlaced=0:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:fullrange=off:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709" @set aproc="pan=stereo|FL < FL+1.414FC+0.5BL+0.5SL+0.25LFE+0.125BR|FR < FR+1.414FC+0.5BR+0.5SR+0.25LFE+0.125BL,firequalizer=gain='if(gte(f,35),0,-INF)+if(lte(f,14000),0,-INF)',dynaudnorm=p=1/sqrt(2):m=100:s=20,firequalizer=gain='if(gte(f,35),0,-INF)+if(lte(f,14000),0,-INF)',aresample=resampler=soxr:osr=48000:cutoff=0.990:dither_method=0" @set vproc="pp=ac,pp=ac,pp=ac,hqdn3d=2,gradfun,scale=iw:ih:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:interl=-1:out_color_matrix=bt709,format=pix_fmts=yuv420p" @ffmpeg.exe -hide_banner -v 32 -stats -y -color_range 2 -i "%1" -sn -dn -vf %vproc% -c:v libx264 -preset faster -tune film -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -af %aproc% -c:a libmp3lame -q:a %aq% -f matroska "%~n1.mkv" @endlocal
-
Im sorry pandy but this is all beyond me for my little brain LOL. as I dont have a clue. all i normally do is drop video what has subtitles onto the ffplay.bat it shows a green oblong box over movie so then I measure where to cover subs, then take those numbers, IE: delogo=x=70:y=292:w=146:h=46 and copy to the logo.bat file and it just blurs subtitles
I have never done anything regarding codecs etc. this is too much for my small brain LOL
but I am a slow learner. -
No worry, no rush - my point was - when you adjusting audio level then your compressed audio stream need to be decoded\decompressed, later audio processing can be applied and after this your audio must be stored somewhere in some format and you selected AC-3 audio codec with bitrate 192kbps
Code:-c:a ac3 -b:a 192k
You need to do same steps when you applying your delogo for video signal - it need to be decoded, delogo filter applied and at some point video must be stored in some file in some format and this missing from your script for delogo. Literally you need to specify somewhere something likeCode:-c:v libx264 -crf 22
-
I will never be able to learn this as its way too hard for me. Im too old for this now LOL. could you not do me a script what blurs subtitles etc. the one i have so far seems ok but you are saying about codec etc which is double dutch to me.
-
Geen probleem Meneer, echter om Uw probleem op te lossen, moet ik meer details weten. (it was Dutch) and English: no problem Sir, however to solve Your problem i need to know more details... sorry can't resist still miss Netherlands.
Just give me some details about video codec, container you wish to use.
Aaaah - i see why you are so confused - seem ffmpeg use by default h.264 automatically - when you process video and not providing detailed and required video codec setting then by then ffmpeg use default video codec which is obviously h.264 with some settings, seem this is fine for you, will try to mimic this behaviour then but call explicitly h.264.
not tested this script but should work (if not just give me error feedback) - you can (should) modify this script to adjust delogo filter settings accordingly to your needs.
btw audio is also processed trough dynaudnorm filter.
Code:@setlocal @rem folder where ffmpeg.exe is located @set FF=C:\ffmpeg-3.4-win64-static\bin @set PATH=%FF%;%PATH% @set filename=%1 @rem video quality settings @set vq=23 @audio bitrate @set ab=192 @SET x264opts="crf=%vq%:level=4.0:qpmin=12:vbv_maxrate=19999:vbv_bufsize=9999:ref=3:bframes=3:rc-lookahead=30:cabac=1:interlaced=0:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:fullrange=auto:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709" @rem delogo filter settings @set blurlogo=delogo=x=70:y=292:w=146:h=46 @set vproc="pp=ac,%blurlogo%,scale=iw:ih:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:interl=-1:out_range=auto:out_color_matrix=bt709,format=pix_fmts=yuv420p" @set aproc="pan=stereo|FL < FL+1.414FC+0.5BL+0.5SL+0.25LFE+0.125BR|FR < FR+1.414FC+0.5BR+0.5SR+0.25LFE+0.125BL,dynaudnorm=p=1/sqrt(2):m=100:s=20" @ffmpeg.exe -hide_banner -v 32 -stats -y -i "%filename%" -vf %vproc% -c:v libx264 -preset faster -tune film -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -af %aproc% -c:a aac -b:a %ab%k -f matroska "%%~n1_delogo.mkv") @endlocal @pause
Last edited by pandy; 19th Nov 2017 at 07:48.
-
what exactly is this script for just to blur a subtitle and also enhance audio or just the 1st part blur subtitles. its no good asking me for stuff on this as dont have a clue
do i also have to put path to ffmpeg hereCode:@rem folder where ffmpeg.exe is located
-
Script will do:
audio filter - audio is downmixed, this works up to 7.1 channel audio configuration, target is stereo downmix with enabled LFE (low frequency channel for subwoofer) and center channel audio emphasized (increase perceived loudness for dialogues assumed that they are in center channel), downmixed audio is pass to dynaudnorm filter where audio peak level can't be higher than -3.0103dBFS (recommended maximum peak level for digital audio) - this ends audio filtering
video filter - video is passed to postprocessing (deblock, dering), delogo filter is applied to video with parameters provided by You, later video is passed to resize filter however this filter not perform any resize as output video will have same size as source however two things are performed, first video signal range is forced to auto so follow source, secondly all video going out of this filter should be with proper color matrix BT.709 as this color matrix is signalled by H.264 to decoders - proper decoder shall used this information and video should have proper color on screen (this is cosmetic settings - i could ignore this then rely purely on how decoder will set colormatrix).
Finally audio is compressed to AAC with 192kbps bitrate and video is compressed to H.264 video codec with good quality (some settings forcing video encoder to create more compatible stream with older HW encoders - impact on quality should be marginal), also i use preset faster as in most cases it provide very fast video compression with acceptable bitrate increase (storage cost is nowadays quite low).
@rem means comment ie ignored line - added as information, if you change folder where ffmpeg.exe is located you should edit line bellow this comment i.e.
Code:@set FF=C:\ffmpeg-3.4-win64-static\bin
That's all. -
so am i clear in that this script does all i need like enhance audio, enhance video, and also blurs subtitles or am I completely wrong as all this is too much for my brain LOL
-
-
when you say recompress video do you mean like zip it up like winrar etc. then use that script, Im sure I am completely wrong if so how do you recompress it. I believe this script is in case you want to enhance audio and sort video, and blur subtitles. all in one, but say you only want to enhance audio or say just blur subtitles
-
Then create 3 different batch files - one where audio and video is filtered, second only audio but video is copied losslessly and third where audio is copied losslessly.
of course you can create single batch where you can select which type of processing is OK but IMHO faster is to use 3 different scripts than single script with selection. -
Anyway I would just like to thank you very much for all your help. But this is way beyond me. But will use your script
-
Glad if you finding this useful.
Bellow 3 scripts.
Audio + Video processing script:
Code:@setlocal @echo Audio + Video processing @rem folder where ffmpeg.exe is located @set FF=C:\ffmpeg-3.4-win64-static\bin @set PATH=%FF%;%PATH% @set filename=%1 @rem video quality settings @set vq=23 @rem audio bitrate @set ab=192 @SET x264opts="crf=%vq%:level=4.0:qpmin=12:vbv_maxrate=19999:vbv_bufsize=9999:ref=3:bframes=3:rc-lookahead=30:cabac=1:interlaced=0:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709" @rem delogo filter settings @set blurlogo=delogo=x=70:y=292:w=146:h=46 @set vproc="pp=ac,%blurlogo%,scale=iw:ih:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:interl=-1:out_range=auto:out_color_matrix=bt709,format=pix_fmts=yuv420p" @set aproc="pan=stereo|FL < FL+1.414FC+0.5BL+0.5SL+0.25LFE+0.125BR|FR < FR+1.414FC+0.5BR+0.5SR+0.25LFE+0.125BL,dynaudnorm=p=1/sqrt(2):m=100:s=20" @ffmpeg.exe -hide_banner -v 32 -stats -y -i "%filename%" -vf %vproc% -c:v libx264 -preset faster -tune film -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -af %aproc% -c:a aac -b:a %ab%k -f matroska "%~n1_delogodynaudio.mkv" @endlocal @pause
Code:@setlocal @echo Audio processing, video is copied losslesly @rem folder where ffmpeg.exe is located @set FF=C:\ffmpeg-3.4-win64-static\bin @set PATH=%FF%;%PATH% @set filename=%1 @rem audio bitrate @set ab=192 @set aproc="pan=stereo|FL < FL+1.414FC+0.5BL+0.5SL+0.25LFE+0.125BR|FR < FR+1.414FC+0.5BR+0.5SR+0.25LFE+0.125BL,dynaudnorm=p=1/sqrt(2):m=100:s=20" @ffmpeg.exe -hide_banner -v 32 -stats -y -i "%filename%" -c:v copy -af %aproc% -c:a aac -b:a %ab%k -f matroska "%~n1_dynaudio.mkv" @endlocal @pause
Code:@setlocal @echo Video processing, audio is copied losslessly @rem folder where ffmpeg.exe is located @set FF=C:\ffmpeg-3.4-win64-static\bin @set PATH=%FF%;%PATH% @set filename=%1 @rem video quality settings @set vq=23 @SET x264opts="crf=%vq%:level=4.0:qpmin=12:vbv_maxrate=19999:vbv_bufsize=9999:ref=3:bframes=3:rc-lookahead=30:cabac=1:interlaced=0:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709" @rem delogo filter settings @set blurlogo=delogo=x=70:y=292:w=146:h=46 @set vproc="pp=ac,%blurlogo%,scale=iw:ih:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:interl=-1:out_range=auto:out_color_matrix=bt709,format=pix_fmts=yuv420p" @ffmpeg.exe -hide_banner -v 32 -stats -y -i "%filename%" -vf %vproc% -c:v libx264 -preset faster -tune film -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -c:a copy -f matroska "%~n1_delogo.mkv" @endlocal @pause
Last edited by pandy; 26th Nov 2017 at 05:27. Reason: fixed errors in scripts, scripts are tested and working OK - sorry for errors
-
Ok so the 1st script will check Audio + Video I see you have also included the delogo script. so am i correct in saying this will also blur subtitles as well as checking audio and video
2nd script checks just audio, not video or subtitles
and the 3rd script checks just audio and also subtitles
or am i completely wrong. I thank you so much for all this. I dont have any movies yet to test them on but I will do soon as I get some -
1-st script process audio AND video (by processing i mean any filtering is allowed, it can be for audio level normalization, it can be video delogo filter)
2-nd will process (filtering) Only Audio, video stream will be copied (so no filtering applied to video)
3-rd will process (filtering) Only Video, audio stream will be copied.
By copying i understand lossless process to copy data from source to target.
Each script has short name displayed on screen (check text after @echo - should be in 2 second visible line (3-rd physical) line of script, under @setlocal command).
I can imagine some small improvements (increase robustness when you process only video or audio with first script but this is future). -
ok i will test these when i get a movie to use on them
your help has been invaluable to me. so cant thank you enough
Similar Threads
-
FFMPEG doesn't capture audio from .m3u8 file
By nick9826 in forum Capturing and VCRReplies: 0Last Post: 24th Nov 2016, 10:23 -
Saving AAC audio section from mkv file in ffmpeg
By ShadowEdit in forum AudioReplies: 8Last Post: 7th Mar 2015, 15:54 -
FFMPEG: how to get uncompressed audio in a MP4 file?
By marcorocchini in forum Newbie / General discussionsReplies: 1Last Post: 15th Feb 2015, 09:37 -
How to Replace The Audio File on MP4 with ffmpeg?
By morsh in forum Newbie / General discussionsReplies: 2Last Post: 29th Sep 2014, 07:46 -
audio from .mxf file with FFMPEG
By marcorocchini in forum Newbie / General discussionsReplies: 4Last Post: 27th Dec 2013, 17:29