Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
24th June 2024, 17:01 | #1 | Link |
Registered User
Join Date: Apr 2003
Location: USA
Posts: 107
|
How to disable de-interlace in ffms2 source
Searched, but couldn’t find an answer to what must be a silly question. I have an archival .avi file (mjpeg/wav) that has become corrupted after 25 years. Nothing worked, (neither AviSource, DirectShowSource, nor LSMASHsource) until I was finally able to open it correctly in AviSynth using ffms2 source (ffms2-5.0-msvc). Hurray! Now I can save to lossless HuffyUV! Unfortunately, I have one more problem: ffms2 de-interlaces the video by default, but I want to preserve the original de-interlacing (Pal 50i). What’s more, the de-interlacing has introduced some artifacts that distort the video. Can ffms2 pass a command from an avs scripy to disable de-interlacing? My sincere thanks in advance to anyone who can help me with this problem. This video is very dear to me, and I’d hate to lose it.
|
24th June 2024, 19:08 | #2 | Link | |
Registered User
Join Date: May 2006
Posts: 4,026
|
Quote:
|
|
24th June 2024, 21:43 | #3 | Link |
Registered User
Join Date: Apr 2003
Location: USA
Posts: 107
|
My film was archived in 28 separate .avi files each about 500MB on a single layer writable DVD. Only the first file is corrupt. The other 27 files open in VirtualDub2 and show clearly, in high motion areas, the interlaced fields. Please see the attached jpeg named “VirtualDub2.jpeg.” Compare this to a frame named “ffms2.jpeg,” which was from the corrupted file that I managed to open in AviSynth+ with ffms2 source. All the fields have been de-interlaced.
|
25th June 2024, 10:30 | #4 | Link |
Registered User
Join Date: May 2006
Posts: 4,026
|
Can you upload short snippets (few seconds) of the 2 original files?
(Maybe upload to a file hoster like Mega or similar). Were the 2 clips shot with the same camera? MJPEG is poorly standardized. It can be progressive or interlaced depending on codec/camera or camera setting options. Any video processing in place when the files were archived to the DVD? Edit: Try to set the framerate in ffms2(), something like ffms2("your_source",fpsnum=25,fpsden=1). Maybe it picks only fields from the corrupted .avi Last edited by Sharc; 25th June 2024 at 13:24. |
25th June 2024, 16:54 | #5 | Link |
Registered User
Join Date: Apr 2003
Location: USA
Posts: 107
|
Sorry about the long post! The corrupted avi is named “001.avi”. The weird thing is that I can open it in VirtualDub2, where it plays perfectly. I can even grab a frame using “export” command. See “VirtualDub2_001.jpeg.” There you can see that the fields have not been de-interlaced. But when I try to save “001.avi” in VirtualDub2 (using direct stream copy or some compression codec), I get the error message: “File format is incompatible.” AviUtl will open, play and save the file, but the output looks like: “AviUtl.jpeg.” The video looks the same as “AviUtl.jpeg” when I open the file in AviSynth+ using the following script:
A=LWLibavAudioSource("001.avi") V=LWLibavVideoSource("001.avi") AudioDub(V,A) The weird thing is that half the time, when I open the file with this script, it looks and plays normally and doesn’t de-interlace the video in VirtualDub2’s playback window, then a frame grab looks like: “VirtualDub2_001.jpeg” – i.e., no de-interlacing! Even then, however, when I save the file in VirtualDub2, (regardless of whether it’s a direct stream copy of video/audio, or compressed with some codec), the output video always looks like: “AviUtl.jpeg.” The other half of the time, the above avi script even looks like “AviUtl.jpeg” in VirtualDub2’s playback window! I tried your “fpsnum=25,fpsden=1” in ffms2 source and the output was still de-interlaced. When I saved the film in 28 parts to 4 DVD-R disks, I simply cut the film in the timeline of Adobe Premier and exported each section separately as an avi file, which I simply copied to the root of the DVD-R disk. Do you have a Gmail account? If so, I have uploaded the corrupted file, “001.avi” as well as a non-corrupted file from the same camera/capture board, called: “003.avi” Please find the two links below! JFYI, the file was recorded with a PAL MiniDV camcorder, but because my tech advisor was afraid that our Pentium III workstation couldn’t handle the editing demands, we imported the video into the workstation using the camera’s analog SVHS- PAL output port. That way, playback in the timeline was accelerated by the hardware capture card. The original DV footage, was, I believe progressive PAL 25p, (720x576) but I no longer have the cassettes to verify. I believe the camcorder interlaced the progressive video when it outputted via its SVHS port. Links to Google Drive: 001.avi – corrupted file – opens, plays but doesn’t save properly. https://drive.google.com/file/d/17Xb...ew?usp=sharing 003.avi – good file – opens, plays and saves/compresses properly. https://drive.google.com/file/d/1wIS...ew?usp=sharing |
25th June 2024, 20:51 | #6 | Link |
Registered User
Join Date: May 2006
Posts: 4,026
|
Something is strange.
Here a workaround. Reencoding it with x264 into .mp4 container seems to work. It is encoded interlaced. https://mega.nz/file/6R1HgJ6K#LL1zOq...U4vAaJV-Me_J9Y (You can encode lossless with x264 as well, just set --crf 0) Edit: It works using the ffmpeg Huffyuv codec. Here the Huffyuv interlaced lossless file https://mega.nz/file/nQFgHBgR#o61KPA...iVv2EXxOdZ3jT4 ffms2 as a source filter seems to fail. You need to install the Picvideo codec and open the file with AviSource() rather than with ffms2. Here the Picvideo codec (trial version): https://mega.nz/file/TINWgZrA#z2vzac...ZJn80LxB-kds0E It also works with Virtualdub2. Last edited by Sharc; 25th June 2024 at 23:33. |
26th June 2024, 04:29 | #7 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,934
|
ffms2 r2390 and ffms2 version 5.0 and lsmash opened the AVI in Avisynth for me. BSVideoSource didn't know what to make of it.
There was a lot of aliasing when ffms2 was decoding as it appeared to be de-interlacing but not for LWLibavVideoSource. I'm not sure why, but VirtualDub2 often displays nothing but blank frames for a while when opening the AVI with the AVI Driver (taking a long time to display something, and it upsets AVIFile compatibility mode). It's over my head, but it's as if the fields are stored together at the beginning but separately later on. SMPlayer starts off displaying frames then switches to displaying fields as frames, I assume. Last edited by hello_hello; 26th June 2024 at 07:31. |
26th June 2024, 04:45 | #8 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,508
|
Quote:
With the file directly loaded, file=>file information will tell you what is being used to decode |
|
26th June 2024, 06:40 | #9 | Link |
Registered User
Join Date: Apr 2003
Location: USA
Posts: 107
|
@Sharc
Wow! That PICVideo MJPEG codec was the answer to all my problems! Thank you so much for taking the time to help me out! I really appreciate it! You are a life saver. I mean it! Unlike FFMpeg, the PicVideo codec even opens the corrupted file perfectly in AviSynth+, as you said. For that matter, VirtualDub2 also opens it correctly – wonder what it uses to do that? I tried to buy the PICVideo codec, however, their web site says it’s no longer for sale! I notice that the trial version counts how many times you use it. So I did an end task on VirtualDub2 to save one instance of my limited uses. What a mistake! Unfortunately, after that the codec no longer works on my system. Whenever I click on continue, it counts another use, but won’t let the program access the codec. I have to do another end task to close VirtualDub2. I tried uninstalling and reinstalling the PICVideo codec, but that didn’t solve the problem. Unfortunately, system restore was turned off on the computer that I am using, so I wasn’t able to roll back to an earlier restore point. No worries, I can use another computer to get my job done. I was, however, wondering what exactly the limitations are on the trial version? Is there any workaround to these limitations? Thanks again for solving my problem! @hello-hello With regard to that error message about a frame height of 272 vs 270, I noticed that VirtualDub2 opens the file and plays it well, but for some reason it opens it as with a file size of 720x544 when the original file is actually 720x540. VirtualDub2 also saves it with the same enlarged dimensions! Does that mean that it automatically resizes the fields? Since this copy is for archival purposes, I’d hate to suffer the slight quality loss that an unnecessary resize would occasion. @poisondeathray I do have “prefer internal video decoders” enabled in VirtualDub2. With the exception of the resize mentioned about, it opens and plays the avi files correctly, without de-interlacing and introducing all those nasty articacts. The PICVideo codec even leaves the file as is, i.e.: 720x540. @everyone: Thanks for your help! |
26th June 2024, 08:23 | #10 | Link | |
Registered User
Join Date: May 2006
Posts: 4,026
|
Quote:
Even the free version of Revo Uninstaller seems to reset the Picvideo counter (use the "Scan" for a complete uninstall). https://www.revouninstaller.com/de/r...free-download/ https://www.snapfiles.com/get/revouninstaller.html Last edited by Sharc; 26th June 2024 at 08:26. |
|
26th June 2024, 09:29 | #11 | Link |
Registered User
Join Date: May 2006
Posts: 4,026
|
... and ffms2() seems to work as well when you just trim (cut) the first 564 frames of your 001.avi. There seems to be something odd is going on at the beginning of the clip which fools most codecs, so
Code:
ffms2("001.AVI") trim(564,0) assumeTFF() Edit: Here a workaround for the full 001.avi file, splitting it into 2 parts: Code:
v1=ffms2("001.AVI") v2=ffms2("001.AVI") v1=v1.trim(0,563) v2=v2.trim(564,0) v=v1++v2 v=v.assumeTFF() return v Last edited by Sharc; 27th June 2024 at 11:39. Reason: added v=v.assumeTFF() to set the field order |
26th June 2024, 22:44 | #12 | Link |
Registered User
Join Date: Apr 2003
Location: USA
Posts: 107
|
That's amazing. I added audio to your script and was able to save to HuffyUV (YUY2) / Wav in avi container! Hurray! This is especially welcome as the PICVideo curse has settled upon all my software. I tried to install the codec on my personal workstation only to find that the same abortive behavior was reproduced there as had occurred on the first computer. The only think I can think of is that I migrated by copying the same installer via USB drive to the second computer. Alas, the super uninstaller didn't work its magic for me. I even set a restore point on my workstation, but the curse was upon it even after the roll-back. Therefore, your second solution is every bit as welcome as your first. Thanks again!
Edit: Like VirtualDub2, (which allegedly uses FFmpeg), AviSynth+ (Using FFms2 Source) opens "001.avi" with a frame size of 720x544, whereas the actual frame size of the saved avi file is 720x540. On the other hand, PICVideo's MJPEG codec preserves the original frame size. 1) Do you know why the frame size is enlarged when opening with FFMpeg? 2) Also, do you know how this is accomplished? Last edited by t_2; 26th June 2024 at 23:03. |
27th June 2024, 08:16 | #13 | Link | |
Registered User
Join Date: May 2006
Posts: 4,026
|
Quote:
The recorded frame is actually 720x544 which is mod16, means 720/16=45 macroblocks horizonzally and 544/16=34 macroblocks vertically. PICvideo seems to crop 4 pixels vertically in order to make the frame exactly DAR 4:3 (720:540 = 4:3). If you compare the 2 variants you will see that the ffms 720x544 version has indeed 4 pixels more picture content at the bottom, but 720:544 is not exacly 4:3 but 1.32353. Similar one sees with blu-ray: DAR 1920x1080 (16:9), but internally it is actually processed as 1920x1088. P.S. And add AssumeTFF() in your script. See my corrected post #11. Last edited by Sharc; 27th June 2024 at 10:30. |
|
27th June 2024, 13:21 | #14 | Link | ||
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 7,121
|
Quote:
With the PICVideo decoder do you obtain some audio/video in this first part? Also ffms2 must output audio and video but I only get video without audio. I obtain good deinterlacing with: Quote:
Of course you can let it like 50i, without QTGMC, but I can't recommend recode it like 50i.
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 27th June 2024 at 13:47. |
||
27th June 2024, 19:44 | #15 | Link | |||
Registered User
Join Date: May 2006
Posts: 4,026
|
Yes, but with the title text "Nagyböjt" at the end. I think the first part is corrupted as I understand from the OP, but I rather think that the black frames are ok as the audio only starts together with the text "Nagyböjt". Only the OP t_2 can tell whether something is missing.
Quote:
Quote:
Quote:
Last edited by Sharc; 27th June 2024 at 22:44. |
|||
10th July 2024, 17:29 | #16 | Link |
Registered User
Join Date: Apr 2003
Location: USA
Posts: 107
|
Thank you to one and all! I managed to get QTGMC installed on my old Win7 workstation and the results are amazing!! I remember 50 years ago when I first heard about digital compression (PNGs, I think), I was amazed that you could compress close to 50% without losing quality. I experienced something of the same wonder after seeing the results of the QTGMC de-interlacer. The overall video quality (judged by apparent sharpness) seems to have increased dramatically over the original master copy! And the motion at 50p is so much smoother.
These results have caused me to ponder whether another grave limitation of our film could easily be corrected. The film is a 60 min drama produced by our Catholic high school. When I started the project, I didn't even know about XLR cables, focus, lighting, editing, etc. As a result, although we shot the film in one week (with a camcorder on autofocus), it was in post production for 2 years, while we dubbed most of it and learned to use all kinds of video special effects (Blackbelt System's WinImiges program) to clean up the video. One problem, I never got around to tackling was the exposure problems. Not only did we use auto-focus, we also shot the entire film without artificial lighting. After this long explanation, my simple question is this: Does anyone know of a filter/plugin that can correct video that was poorly exposed. For example, some of our video was taken against the backdrop of a bus window, with the result that the window is properly exposed, while the faces of the actors in the foreground are underexposed. Thanks for considering this problem! Edit: In the meantime, I found HDRAGC plugin, which does what I wanted, and am currently experimenting with it! Last edited by t_2; 11th July 2024 at 06:53. |
11th July 2024, 16:26 | #17 | Link |
Registered User
Join Date: Apr 2003
Location: USA
Posts: 107
|
I'm trying to experiment with HDRAGC (High Dynamic Range Automatic Gain Control ) plugin, however it is 32 bit. After searching for hours, I finally managed to find an x86 binary for Media Player Classic which invoked a 32 bit instance of Avisynth+, however I'm not able to encode with this media player. Does anyone know where I can get 32 bit versions of VirtualDub2. I found a 32 bit binary for AviDemux but the install lacked the 32 bit version of the avsproxygui.exe. It has both 32 bit and 64 bit versions of the proxy itself but I don't know how to use the command line. Thanks in advance to anyone who can point me in the right direction. Is there some way (some command I can add to my avs script) of invoking a 32 bit version of Avisynth+ that would run in 64 bit VirtualDub2? Sorry, if this is a silly question, but I'm rather clueless.
|
11th July 2024, 16:42 | #18 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,731
|
https://sourceforge.net/projects/vdf.../version%2020/
44282 zip contains both 32 and 64 bit versions. You just run the 32bit version (VirtualDub.exe) 4008KB
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." |
11th July 2024, 17:08 | #19 | Link | |
Registered User
Join Date: Jul 2018
Posts: 501
|
Quote:
You can check the thread for usage examples. |
|
12th July 2024, 07:54 | #20 | Link |
Registered User
Join Date: Apr 2003
Location: USA
Posts: 107
|
Many thanks to Emulgator for the link to the x86 binary of VirtualDub2. That solved my problem because now I can run the HDRAGC plugin in 32 bit environment and save to lossless and then import this video into my script that calls 64 bit version of Avisynth+.
Many thanks also to StvG for the MP_Pipeline Plugin! I have written the script below which I feed to VirtualDub2 x64. (I put the 4 files in the x64 folder of MP_Pipeline download into the plugins64+ folder of Avisynth+ and the 4 files from the x86 folder into the plugins+ folder of Avisynth+, But when I run the script in VirtualDub2 x64, I get the following error message: Avisynth open failure MP_Pipeline: Unable to create slave process. Message: (C:\Users\password\Desktop\HDR\HDRx64.avs, line 18 Here is my avs script: ################################################## A=FFAudioSource("ivp2.mp4") V=FFVideoSource("ivp2.mp4") A=AudioDub(V,A).Trim(43549,50398).KillVideo() MP_Pipeline(""" SetMemoryMax(3072) FFVideoSource("ivp2.mp4") ShowFrameNumber() Trim(43549,50398) HDRAGC() ### prefetch: 16, 0 ### ### """) Final=AudioDub(A) Return Final ###################################################### In this script, I’m trimming out a portion of the film where the actors are filmed against the backdrop of a bus window. Their faces are very underexposed, so I use HDVAGC to lighten up the shadows. It gives very good results. I separated the audio from the video because I read in the Doom9 forum that MP_Pipeline, at least in its earlier versions couldn’t handle audio. I’m sure I’m committing the most rudimentary of errors, but can’t figure out what it might be. Any help would be much appreciated! |
Tags |
de-interlacing, ffms2 |
Thread Tools | Search this Thread |
Display Modes | |
|
|