PDA

View Full Version : creating HD 1080i video from static image with silent sound - please comment


florinandrei
21st April 2010, 01:10
Many HD camcorders today produce video files which are 1080i (1920 x 1080 @ 60i) AVCHD-compatible H.264 with usually AC3 sound. Encapsulation can sometimes be M2TS.

My goal was to produce brief text inserts to mux in between video sequences - so there's some video from the camera, then this artificially generated static video (text on a black background) with silent sound, then some more video, etc. The focus is on the compatibility with the video files produced by the camera.

This is what I have done so far, please comment.

The static video was generated from a PNG image made with Gimp. I put all the PNGs in the img subdirectory. All video and audio files are created in the video subdirectory.

The AVS script:

video = ImageSource("img\main_title.png", end = 300, fps = 59.94, use_DevIL=true)
audio = BlankClip(video, audio_rate = 48000, channels = 2)
AudioDub(video, audio)
AssumeTFF
SeparateFields
SelectEvery(4,0,3)
Weave
SoundOut(output = "ac3", filename = "video\main_title.ac3", showprogress = true,
autoclose = true, wait = 0, overwritefile = "yes", cbrrate = 256, acmod = 2)

The silent audio stream is made with BlankClip.
The initially progressive 60p video is converted to 1080i60.
SoundOut creates the AC3 audio file.

This is the do_video.bat file which uses the AVS script, creates the video and the audio tracks:

x264.exe --crf 21.5 --thread-input --trellis 0 --profile high --level 4.1 ^
--bframes 3 --ref 4 --slices 4 --aud --nal-hrd --b-pyramid strict --keyint 24 ^
--min-keyint 2 --vbv-maxrate 14000 --vbv-bufsize 14500 --sar 1:1 ^
--output video\main_title.mp4 main_title.avs

Basically I used an AVCHD profile from MeGUI. Change the value for --crf if you need different quality (lower crf is higher quality). The x264.exe program is the one that MeGUI downloads in its tools directory.

This is the META file for tsmuxer:

MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr --vbv-len=500
V_MPEG4/ISO/AVC, video\main_title.mp4, fps=29.970, insertSEI, contSPS, track=1, lang=eng
A_AC3, video\main_title.ac3

And this is how tsmuxer is actually launched:

tsmuxer main_title.meta video\main_title.m2ts

The static video file with silent sound is now ready to be inserted in between two live video files from the camera!

If there are any obvious mistakes, or if you think this can be improved, please let me know. Thanks.

2Bdecided
21st April 2010, 09:26
Since it's static, you don't need to interlace it in AVIsynth (it's a NOP!) - just specify half the frame rate in the ImageSource line. This is nit picking though - it makes no practical difference.

Nice idea.

I was going to suggest a very small vertical blur to avoid interlaced twitter on any fine details, but reasonable displays are going to spot it's a still picture and kill the twitter anyway, so there's probably little point - might as well keep it sharp.

Cheers,
David.

florinandrei
21st April 2010, 18:00
I'm really trying to be very pedantic, as I'm going to daisy chain video from the camera with "static video" I make, and kind of mux them into a giant single file with tsmuxer, and I want to keep the various video sources as similar as possible. I've been burned before by slight differences like this, I want to avoid that. The video may be uploaded to YouTube, played on various media players and appliances, etc. The smaller the differences between one "chapter" and another the better.

The video from the camera is kind of finicky, or maybe it's just ffmpeg / libavcodec that for a long time wasn't quite able to deal with the format very well. After all, it is standards-compliant 1080i AVCHD, but I remember a while ago anything based on ffmpeg / libavcodec was creating huge artifacts when playing it. Maybe it's fixed nowadays, I'll have to try again.

BTW, the camera is not some obscure no-name product, it's a Canon HF100.

Since it's static, you don't need to interlace it in AVIsynth (it's a NOP!)

Um... huh? Can you provide more details?

I was going to suggest a very small vertical blur to avoid interlaced twitter on any fine details

I expect all recipients of this video to discern and be able to deal with interlaced video properly - deinterlacers nowadays are pretty good. Also, it's HD so even if the deinterlacer is not perfect, it doesn't matter as much as it would if it were SD.

Also, the details are not exactly tiny. The images are mostly large text. Will there be any "vibration" occurring at sharp horizontal or diagonal edges? I don't know yet, I did some tests with software players (VLC, mplayer) and I couldn't see any. I'll know for sure when I play it on the PS3.

Alex_ander
21st April 2010, 18:59
Can you provide more details?

This operation only halves the framerate by using one field from current frame and another field from exactly the same following frame. Both input / output videos are progressive.
First, by field separation in the assumed order, you get sequence of fields:
T0,B0,T1,B1,T2,B2,T3,B3....Then of each 4 sequential fields 2 are left for weaving: T0,B1,T2,B3.... where B1=B0, B3=B2 etc. So unless you use some transition (like fades) for your inserts before AssumeTFF etc., you output the same frames and the whole interlace conversion (incl. double input framerate) is No OPeration.

2Bdecided
22nd April 2010, 10:45
Will there be any "vibration" occurring at sharp horizontal or diagonal edges?Yes with dumb-bob deinterlacing, no with motion adaptive deinterlacing.

Cheers,
David.