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.
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.