Lily Allen - Main Square Festival restoration

I came across an awesome concert Lily Allen did in 2009, however “something” happened to the video. It was one of the noisiest high-def vids I’ve seen and was a juddery PAL to NTSC conversion done by inserting duplicate frames (rather than high quality interpolation).

specs of what I had:
AVC 1920x1080p 5144Kbps 16:9 29.970fps High@L4 0.083Bit/(Pixel/Frame), 53:42 time, 80446 frames
HE-AAC 127Kbps 2 channel

The audio in the video was poor. HE-AAC is anti-musical (IMO). It uses spectral band replication and best for 64Kbps or lower. 127Kbps is well within the range that AAC LC performs well and I can only imagine an inexperienced hard-of-hearing person made that decision. With HE-AAC, the high end is actually synthesized- picture a gated and EQed high frequency noise generator with cues from the source about what to synthesize… fortunately I had good audio from a SD video of the same feed with 256Kbps MPEG2 audio (roughly equivalent to 160Kbps AAC LC in quality). I had already done the audio switcharoo in an earlier project, but it went something like:
Demux 720x576i.mpg to .m2v and .mp2.
Remux the 1920x1080p.avc with .mp2 to .mkv (discarding the bad .aac track)

This video I believed could be made shiny with Avisynth and VEAI. First I fixed the judder with TDecimate. I knew the native rate was 25fps as this was recorded in France and the SD vid was 25fps. I saw the repeated frame pattern, but had no idea how to automatically remove it. The bright folks at Videohelp forums provided this after I uploaded a sample:

The function worked, except for unknown reasons the fps was 24.975. No matter, close enough. I could get it to 25fps via Avisynth, VEAI, and Audition. I use an ancient (free from Adobe) version Audition 3.0 that still has the same functions as CoolEdit (which I have years of experience with).

VEAI 1.8.0 ArtemisMQv9 cleaned up the noise and added detail. I don’t know any Avisynth functions that can perform as well.

The process:
I lucked out that the frame count in the SD and HD videos was the same and that the first and last frames were identical, which means the edit was the same. All simplifying the audio processing.
Audio length at 25fps:
80446 x 0.04sec = 3217.840sec

Note the following is the second try. The first try I did it proper with MkvExtract and DGDecodeNV (via Vdub2 + Avisynth), and the .mp2 converted to .wav with length 3217.840sec (via Audition), but had major audio-video sync issues, so I tried an unconventional method which amazingly worked. I don’t understand why this would make any difference but it did.

With Virtualdub2:
Open the original 1920x1080p lamsf.mkv, set video compression to Lagarith, set to process audio, no compression (PCM).
Save As:

With Virtualdub2 + Avisynth 2.6:
TDecimate(Cycle=6, CycleR=1)

Set to use Lagarith, process audio (PCM) and Save as (this is the file for VEAI):

Demux the 01b-mkv-lamsf-24.975-sat0.85-lag-pcm.avi. You only need the audio at this point, but save the .avi for processing the video later. There’s probably a quicker way, but I convert to .mkv with MkvMerge, then use MkvExtract to get the PCM .wav file.

Open the .wav in Audition. Use the Time and Pitch Stretch process to create an audio track 3217.840sec long. I set it to High Precision and Time Stretch (Constant Vowel unchecked). I’ve done this several times before and those settings have no audible artifacts (takes 4 hours to process on my box). Avisynth has a similar function, but I’ve never tried it (I’ve read it runs way faster than Audition and I’m guessing the quality isn’t as good). Convert to 16/48 and Save as 3217.840.flac. This is the final audio file you’ll need at the end.

Open Video Enhance AI 1.8.0. Set to Artemis-MQv9 at 200% upscale. Set to no audio. Uncheck crop. Output .png sequence. Create and set an output folder. I used “run2”. Process the video. Note you have to use 121% or greater if you want to enable the upscaling AI to enhance detail. 100% deblock/denoise does nothing in my tests (if it works for you, great! it did nothing for me).

With Virtualdub2 + Avisynth 2.6:
vectors=SVAnalyse(super, “{}”)
SVSmoothFps(super, vectors, “{}”, mt=1)
vsMSharpen(threshold=6.0, strength=35.0, mask=false, luma=true, chroma=true)

x264 Slower Film High L4.2 YUV 4:2:0 SAR 1/1 CRF 16.5

Save as (this is your final video file before remuxing).

Some notes regarding the script above:
I took advantage of having the output in .png and easily changed the framerate from 24.975 to 25fps via the fps parameter in ImageSource. I cropped as needed and resized to the original size. I verified that the aspect ratio looked good in Virtualdub2. I used CAS and vsMSharpen together which usually results in an astigmatism effect (with most videos you use one or the other). In this case it just sharpened really well (sometimes you get lucky).

SVSmoothFps invokes SVPFlow to double the fps to 50 for a more “live” look. I use SVPFlow v4.2.0.142 (free). It works better than FrameRateConverter (much less frame blending and way faster). Note however, if you have a logo or credits and lots of action going on, SVPFlow blows up. I have one video in which that happened. I ended up doing a run of SVPFlow and a run of FrameRateConverter, and used about 1000 frames from the FRC run to replace the bad SVPFlow frames. With .png sequences, you can do editing like that via Windows Explorer.

Remux the 3217.840.flac and 02b-run2b-lamsf-ArtemisMQv9200-cropVD-Spl64Res1920x1080-svp50-cas0.5-vsmsharp6,35-crf16.5.mp4 with MkvMerge. Remember to set the framerate to 50p. Watch and if all is good, the audio will remain in sync with the video. If not, pull some more hair out, cuss, web search, and try again.

This was never sold and is considered a ROIO (Recording Of Independent Origin).

Here’s the before clip (11MB):
before clip on Mega

Here’s the after (9680MB)(don’t click if torrents aren’t allowed where you live):
Lily Allen - 2009-07-03 Main Square Festival, Arras, France (1080p50fps)

I moved the gig from bittorrent to Usenet. You’ll need SABnzbd and a Usenet account to view.

To initiate the download, save this nzb file in your SABnzbd watch folder. Allen - 2009-07-03 Main Square Festival, Grand’Place, Arras, France (1080p50fps).nzb