The original video is just a crap. Thanks for your valuable inputs.
I think, I'll use XVID, 1024kB for video, lower volume in https://www.videohelp.com/software/Video-to-Video-Converter and save whatever I am left with.
Forgot to mention: the audio did sound more pleasant than the original.
+ Reply to Thread
Results 31 to 60 of 73
Last edited by ConverterCrazy; 3rd Mar 2016 at 02:39. Reason: Additional info
Try opening one of the mpeg files with MKVMergeGUI and remuxing as an MKV to see if it offers a warning about the audio and if it's still in sync after remuxing.
MKVMergeGUI (for reasons I don't understand) will drop non-audio data from the audio stream when muxing without compensating for it, so if there's enough non-audio data removed it can go out of sync. The sample has a small amount of non-audio data, according to MKVMergeGUI.
If that's the problem, I'm not 100% sure the best way to go about fixing it, but it's a way to start looking.
You can substitute firequalizer by lowpass filter lowpass=10000 (usual audio bandwidth on VHS is bellow 10kHz - in your case everything above 10kHz is harmonics due clipping and other processing errors - IMHO no useful information at all, save bits for part between 100Hz and 10kHz).
I can think about pipe script to external dynaudnorm filter so level can be normalized automatically even on XP machines).
It is sad that people compiling software with disabled XP support (adding 1 line to makefile is sufficient to provide compatibility with XP) - i can imagine that Microsoft pushing commercial developers but open source should not blindly follow corpo marketing.
Remuxing as an MKV would be a way of testing in non-audio data in the audio stream could be causing the sync problem, but I don't know what ffmpeg does with it when muxing. Some muxers drop it as MKVMergeGUI does, and I think some include it, but if the audio is being converted and just remuxed it's more likely non-audio data will just be skipped. Same if audio gaps.
If there's gaps in the audio stream MKVMergeGUI should keep them intact when remuxing (although I'm not 100% if that's the case when an mpeg file is the source). Once again, I don't know how ffmpeg would handle gaps when converting (pandy probably does), but my next test would be to extract the mp2 audio from the MKV with gMKVExtractGUI or MKVCleaver. It'll be extracted as a contiguous file, ignoring any gaps. Open the MKV, add the extracted mp2 audio, de-select the original audio stream and remux. If the new MKV suddenly develops audio sync problems you'll know the likely reason. The only method I know of for extracting it from the MKV while replacing any gaps with silence is to extract it with eac3to, but if there's no sync problem after remuxing the extracted audio you've probably eliminated problems with the audio stream as the cause.
Wow, very impressed with a couple of your previous FFMPEG examples and have tried them out on a few AC3 multichannel tracks which have yieled some pretty impressive results, cool, and thank you.
How would you deal with, do the same, with a DTS source?
How would you deal with an already 2 channel stereo track, in terms of normalising (and gaining) the dialog?
DTS and stereo should be same - dynaudnorm is after downmixing so at the output always is plain stereo audio.
Hi @hello_hello and @pandy
Here is what I have done (Please see attachments). There are warnings about which I could not do anything as I have no clue how to handle them.
It took over 24 hours on my machine with XP!
The video is OK but AR is bad — should have been 4:3. I have no clue how to correct it without spending hours.
Audio is better than original but is Joint Stereo — should have been stereo.
Hope it helps.
I am grateful for your help.
P.S. The AVI files play on all the devices as I intended.
Last edited by ConverterCrazy; 5th Mar 2016 at 06:04. Reason: Post Scripta
If the idea is to have AVIs that'll play in a standard DVD player (an AVI capable one) you'll probably have to resize to square pixels dimensions when encoding, which means you'll probably have to re-do them. Most hardware players don't support aspect ratios for AVIs because technically the AVI container doesn't support aspect ratios, so setting an aspect ratio probably won't do much good.
According to the "MKV 2 AVI via FFMPEG.txt" file the output AVIs are 50fps, which might also be a problem. I'm not sure if that's correct but if your earlier sample is anything to go by the source is 25fps progressive so there wouldn't be much point in a 50fps output.
I'm a little confused as to how you converted now, given you mentioned Video To Video Converter earlier. If it was ffmpeg, I'll leave it to pandy to help you there.
24 hours is a while. How many files did you have to convert?
Yes, i did write about using V2V converter but the problem with it is that it doesn't handle audio editing (at least I am not aware of it), so I followed the process as suggested by @pandy. His suggestion softened the shrill sounds and 'normalized' the volume.
The number of videos is 92. and the time was nearly 36 hours.
The 50 fps and AR correction is a bit disturbing. I don't know what to do about it.
If I'll have to re-do the job for these, I'll leave the job as-it-is.
For aspect ratio you may consider two options:
- first reencode once again all with added video filter setdar=dar=4/3
@for %%1 in (*.mpg) do (@ffmpeg.exe -stats -y -threads %cput% -i "%%1" -c:v mpeg4 -profile:v mpeg4_asp -slices %cput% -q:v 4 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -vtag DIVX -vf setdar=dar=4/3 -c:a libmp3lame -q:a 5 -af "aformat=sample_fmts=fltp,highpass=f=120,pan=stereo|FL < FL + 1.414FC + .5BL + .5SL|FR < FR + 1.414FC + .5BR + .5SR,aresample=resampler=soxr:osr=48000:dither_method=0,lowpass=10000" -f avi "%cd%\out\%%~n1_dn.avi")
To address your concerns about encoded parameters i've verified them with ffprobe (use your sample clip with provided script with one change aspect ratio set to 4:3) - outcome of this is simple: Joint stereo is method for efficient stereo encoding - it is normal stereo - no need to worry, video is 25 frames.
# ffprobe output
codec_long_name=MPEG-4 part 2
profile=Advanced Simple Profile
codec_long_name=MP3 (MPEG audio layer 3)
Last edited by pandy; 5th Mar 2016 at 14:35.
I can confirm the latest Sherpya build of ffmpeg runs fine on XP and the batch file from post #23 works (I added MKV as an input type).
When the source was the mpeg sample, ffmeg offered warnings about the queue input being backwards in time (in relation to the MP3 encoding), but the output seemed fine.
The problem with the frame rate and aspect ratio seems to be caused by remuxing the source as MKV. I only tested with MKVMergeGUI but it's not setting the correct aspect ratio automatically when remuxing and the output file is reported by MediaInfo to be 50fps even though it plays normally.
If I specify 4:3 and 25p when remuxing the mpeg sample as MKV, that MKV as the source results in a 25fps AVI with a 4:3 aspect ratio.
Personally, I'd resize to square pixels rather than set an aspect ratio as it's likely a hardware player won't obey the aspect ratio for an AVI. I tried adding the scale function to resize it but ffmpeg either gave me a cropped output or resized while setting a new aspect ratio. I guess I don't know how to use the scale function properly but I wasn't motivated to spend a lot of time on it.
Would the source files in question be exactly 4:3 or should they be ITU 4:3? I suspect it's the latter in which case I think the source aspect ratio should be 1.367 rather than 1.333
As a side note..... I downloaded the latest version of Hybrid a few days ago but it wouldn't run, spitting out an error regarding ffmpeg and msvcrt.dll. After replacing ffmpeg.exe in the Hybrid folder with the Sherpya build, Hybrid now runs.
As a learning experience I worked out how to resize. Setting the DAR the same as the resizing seems to be the easiest way to resize to square pixels. I also worked out how to specify a frame rate of 25fps which seems to fix the frame rate problem when MKV is the source. And while I was playing around I worked out how to apply post processing to clean up some of the blockiness, although that slows the encoding speed considerably.
@setlocal @set /a cput=(%NUMBER_OF_PROCESSORS%*3)/2 @if not exist %cd%\out (mkdir %cd%\out) @for %%1 in (*.avi *.mpg *.mkv) do (@ffmpeg.exe -stats -y -threads %cput% -i "%%1" -vf "fspp=5,setdar=384/288,scale=384:288" -r "25" -c:v mpeg4 -profile:v mpeg4_asp -slices %cput% -q:v 4 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -vtag DIVX -c:a libmp3lame -q:a 5 -af "aformat=sample_fmts=fltp,highpass=f=120,pan=stereo|FL < FL + 1.414FC + .5BL + .5SL|FR < FR + 1.414FC + .5BR + .5SR,aresample=resampler=soxr:osr=48000:dither_method=0,dynaudnorm=m=50.0:b=1:s=25.0:p=0.5,firequalizer=gain='if(lte(f,10000),0,-INF)'" -f avi "%cd%\out\%%~n1_dn.avi") @Echo Done! @pause
I don't imagine a second hard drive will speed things up too much, if at all. The CPU seems to be the bottleneck.
Yes, CPU seem to be slow, looks to me like Pentium 4 - that's why i've use libavcodec instead xvid (xvid 4 times slower than libavcodec).
Optimizing system may improve encoding speed but i don't expect miracles.
De-fragmenting hdd (MyDefrag with good scripts like system disk monthly for system disk/partition), removing not useable processes (real time antivirus software may be serious limitation), making swap file permanent (yes, old trick to speedup overall system performance and prevent swap file fragmentation), separating filesystem from data (on 1 hdd at least two partitions, better 2 hdd's with separate disk for data and swap), RAM size is important - for XP and video a least 2GB, if graphic card is embedded type (i.e. RAM is shared with system and video) switching to 16 bit depth for Windows desktop may improve some speed.
I recommend also to disable all beautifiers of desktop - select in advanced windows settings best performance (visual effects tab - yes, disabling shadow under cursor may speed up a bit CPU - all those fractions of % counts on slower machines).
I'd probably encode a file or two while setting an aspect ratio that's obviously wrong.... maybe 16:9.... and test that with the car's player. If the video is obviously stretched the player obeys AVI aspect ratios and it'd be safe to convert to 352x288 at 4:3 (I'd create a file with an aspect ratio that's obviously wrong as 352x288 is close to 4:3 so it might be harder to tell if the player's obeying the aspect ratio or just displaying it as though it has square pixels).
No error displayed. The file creation starts and after 10k the cursor keeps blinking. No progress seen.
I added -report to get ffmpeg to write a log file. There's a whole lot of complaining and warnings included, but the command line used is at the top and it shows a successful output at the bottom. Just so you know I'm not making it up.
I know you are not "making it up".
I tried with -report and got this:
ffmpeg started on 2016-03-06 at 19:23:05
Report written to "ffmpeg-20160306-192305.log"
ffmpeg version N-78734-g666e2ed-Sherpya Copyright (c) 2000-2016 the FFmpeg devel
built with gcc 5.3.1 (GCC) 20160205
Input #0, mpeg, from 'ep001_.mpg':
Duration: 00:43:42.08, start: 0.200000, bitrate: 1385 kb/s
Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p(tv), 352x288 [SAR 178:163 DAR
1958:1467], 1120 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc
Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, stereo, s16p, 224 kb/s
Output #0, avi, to 'E:\MB-original\out\ep001__dn.avi':
ISFT : Lavf57.26.100
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (DIVX / 0x58564944), yuv
420p, 384x288 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
encoder : Lavc57.25.101 mpeg4
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: mp3 (libmp3lame) (U / 0x0055), 48000 Hz, stereo
encoder : Lavc57.25.101 libmp3lame
Stream #0:0 -> #0:0 (mpeg1video (native) -> mpeg4 (native))
Stream #0:1 -> #0:1 (mp2 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
frame= 8 fps=0.0 q=4.0 size= 10kB time=00:00:00.32 bitrate= 249.9kbits/s
frame= 38 fps=0.0 q=4.0 size= 10kB time=00:00:01.52 bitrate= 52.6kbits/s
frame= 69 fps= 46 q=4.0 size= 10kB time=00:00:02.76 bitrate= 29.0kbits/s
frame= 101 fps= 50 q=4.0 size= 10kB time=00:00:04.04 bitrate= 19.8kbits/s
frame= 132 fps= 53 q=4.0 size= 10kB time=00:00:05.28 bitrate= 15.1kbits/s
And it stays there!
I don't know why. Maybe try removing the post processing to see what happens (fspp=5).
Remux as an MKV first? Have you tried another source file?
Does pandy's original batch file still work? Not that anything I added should have broken it, but you never know.
Tried both suggestions. Same result.
I think problem is not in framerate as framerate reported by ffprobe looks OK.
@ffprobe -v quiet -pretty -print_format ini -show_streams %1 > %~n1.nfo
Last question for the day. Pl see the last five lines in the attached log file.
There is some error!
The output file is same as input file.
I have a P-4 dual processor, so I changed this command in your script
@set /a cput=(%NUMBER_OF_PROCESSORS%*3/2
@setlocal @set /a cput=(%NUMBER_OF_PROCESSORS%/2 @if not exist %cd%\out (mkdir %cd%\out) @for %%1 in (*.mpg) do @ffmpeg.exe -report -stats -y -threads %cput% -i "%%1" -c:v mpeg4 -profile:v mpeg4_asp -slices %cput% -q:v 4 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -vtag DIVX -c:a libmp3lame -q:a 5 -af "aformat=sample_fmts=fltp,highpass=f=120,pan=stereo|FL < FL + 1.414FC + .5BL + .5SL|FR < FR + 1.414FC + .5BR + .5SR,aresample=resampler=soxr:osr=48000:dither_method=0,dynaudnorm=m=50.0:b=1:s=25.0:p=0.5,firequalizer=gain='if(lte(f,10000),0,-INF)'" -f avi "%cd%\out\%%~n1_dn.avi" @Echo Done! @pause
@setlocal @if not exist %cd%\out (mkdir %cd%\out) @for %%1 in (*.mpg) do @ffmpeg.exe -report -stats -y -i "%%1" -c:v mpeg4 -profile:v mpeg4_asp -q:v 4 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -vtag DIVX -c:a libmp3lame -q:a 5 -af "aformat=sample_fmts=fltp,highpass=f=120,pan=stereo|FL < FL + 1.414FC + .5BL + .5SL|FR < FR + 1.414FC + .5BR + .5SR,aresample=resampler=soxr:osr=48000:dither_method=0,dynaudnorm=m=50.0:b=1:s=25.0:p=0.5,firequalizer=gain='if(lte(f,10000),0,-INF)'" -f avi "%cd%\out\%%~n1_dn.avi" @Echo Done! @pause
@set /a cput=(%NUMBER_OF_PROCESSORS%*3/2 is incorrect (you forgot about closing bracket) - i wrote this in such way to deal with command line limitations which prevent to perform arithmetic's on float and general observation lead to conclusion that overall number of threads should be %NUMBER_OF_PROCESSORS%*1.5 (so i've wrote 1.5 as 3/2).
Aaa forgot to mention that this variable (cput) was used also to specify slices for sliced encoding (to speed up encoding) - after wrong variable (missing bracket0 this may introduce stall in encoder (not defined number of slices)
in your log:
ffmpeg started on 2016-03-06 at 23:27:16 Report written to "ffmpeg-20160306-232716.log" Command line: ffmpeg.exe -report -stats -y -threads -i Ep092_.mpg -c:v mpeg4 -profile:v mpeg4_asp -slices -q:v 4 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -vtag DIVX -c:a libmp3lame -q:a 5 -af "aformat=sample_fmts=fltp,highpass=f=120,pan=stereo|FL < FL + 1.414FC + .5BL + .5SL|FR < FR + 1.414FC + .5BR + .5SR,aresample=resampler=soxr:osr=48000:dither_method=0,dynaudnorm=m=50.0:b=1:s=25.0:p=0.5,firequalizer=gain='if(lte(f,10000),0,-INF)'" -f avi "E:\\MB-original\\out\\Ep092__dn.avi"
Last edited by pandy; 6th Mar 2016 at 13:08.
Thanks for inputs
Currently, converting all MPG videos to MKV with MKVBatch as the process removes some of the errors.
Will then run your script.
I wonder if there is some good GUI for FFMPEG to use your options.
It may help in two ways. Firstly, it will clear the current job; secondly, I have another job pending. I had bought a set of 20 DVDs from the same manufacturer and its audio is crap.
The valuable discussion with you and pandy may help in my next project too.
I really appreciate that you both have been extremely patient and helpful.
Last edited by ConverterCrazy; 7th Mar 2016 at 03:50. Reason: Spelling