AlanHK
21st December 2007, 19:40
I use HC in batch files to encode AVIs.
So far quite reliable, but I have an odd problem.
(See PS at end for more details.)
This batch file below is what I use, just changing the bitrate and filenames. It puts all the parameters on the command line.
set rate=1710
set ar=16:9
::set ar=4:3
set hc=P:\HCenc\HCenc_022
set mpgd=s:\mpg\
for %%a in (
S60-115
S60-116
S60-117
S60-118
S60-119
S60-120
S60-121
S60-122
) do %hc% -i %~dp0%%a.avs -o %mpgd%%%a.m2v -b %rate% -aspectratio %ar% -pulldown -profile best -matrix qlb -frames 0 999999
This worked on the first 7 files, but then it crashed on the last, on about frame 72.
If I deleted all but the last filename and ran the batch, it crashed again.
But if I ran HCGui, and used exactly the same parameters, it proceeded successfully.
Here is the log for the crash:
-----------------------------------------
| HCenc - MPEG2 encoder - rel. 0.22.0.0 |
-----------------------------------------
MPEG profile@level: MP@ML
input: p:\dvd\s60-1c\s60-122.avs
output: s:\mpg\s60-122.m2v
--------------------
| encoder settings |
--------------------
profile: BEST
frames: 0 58984
framerate: 23.976
aspect ratio: 16:9
bitrate Kb/s: 1710
max. bitrate Kb/s: 8000
pulldown: yes, 23.976 --> 29.97
closed gops: no
VBV check: yes
scene change det.: yes
interlaced: no, BFF
goplen,B-pic: AUTO
dc_precision: 9
scan method: zigzag
bias: 0
chapter frames: 0
time code: 0 0 0 0
CPU: MMX
priority: idle
SMP active: no
matrix: QLB
luminance gain: no
------------------
| source stats |
------------------
nr. of frames in source: 58985
width*height: 720x480
fps: 23.976
nr. of frames to encode: 58985
frames to encode: 0 - 58984
==================================================
And here is the log for the HCGui run on the same AVS file:
-----------------------------------------
| HCenc - MPEG2 encoder - rel. 0.22.0.0 |
-----------------------------------------
MPEG profile@level: MP@ML
input: p:\dvd\s60-1c\s60-122.avs
output: S:\mpg\S60-122.m2v
--------------------
| encoder settings |
--------------------
profile: BEST
frames: 0 58984
framerate: 23.976
aspect ratio: 16:9
bitrate Kb/s: 1710
max. bitrate Kb/s: 8000
pulldown: yes, 23.976 --> 29.97
closed gops: no
VBV check: yes
scene change det.: yes
interlaced: no, BFF
goplen,B-pic: AUTO
dc_precision: 9
scan method: zigzag
bias: 0
chapter frames: 0
time code: 0 0 0 0
CPU: MMX
priority: idle
SMP active: no
matrix: QLB
luminance gain: no
------------------
| source stats |
------------------
nr. of frames in source: 58985
width*height: 720x480
fps: 23.976
nr. of frames to encode: 58985
frames to encode: 0 - 58984
---------------------
| encoding - pass 1 |
---------------------
pass 1 encoding time: 0:54:41 (3281.39 s)
fps: 18.0
--------------------------------
| encoding - intermediate pass |
--------------------------------
bitrate set to: 1710 kb/s
est. outfile length: 513536 kB
intermediate encoding time: 0.1 s
---------------------
| encoding - pass 2 |
---------------------
pass 2 encoding time: 0:53:07 (3186.53 s)
fps: 18.5
------------------
| encoding stats |
------------------
intra matrix used
8 16 19 22 26 27 29 34
16 16 22 24 27 29 34 37
19 22 26 27 29 34 37 39
22 22 26 27 29 34 38 42
22 26 27 29 32 36 40 50
26 27 29 32 36 40 50 61
26 27 29 35 40 50 59 75
27 29 35 40 50 59 75 89
non-intra matrix used
16 17 18 19 20 21 22 23
17 18 19 20 21 22 23 25
18 19 20 21 22 23 24 26
19 20 21 22 23 24 26 28
20 21 22 23 25 26 28 29
21 22 23 24 26 28 29 31
22 23 24 26 28 29 31 34
23 24 25 28 29 31 34 38
nr. of gops: 5209
nr. of frames: 58985
nr. of I-frames: 5209
nr. of P-frames: 15737
nr. of B-frames: 38039
average bitrate: 1710
minimum bitrate: 138
maximum bitrate: 4777
bytes in bitstream: 526610975
bits in bitstream: 4212887800
average Quantizer: 4.202
total CPU time: 1:45:15 (6315.20 s)
total elapsed time: 1:47:49 (6469.17 s)
==================================================
And here is the AVS file:AVISource("S60-122.avi").ConverttoYUY2()
EnsureVBRMP3Sync()
AmplifydB(-3.0)
#ShowFrameNumber(x=100,y=100)
logo=ImageSource("logo117.png").ConverttoYUY2()
t0=1299
t1=9803
t2=10567
t3=23526
t4=24306
t5=36163
t6=36884
t7=47504
t8=48270
#Trim(0 ,t0 ).NoLogoAuto(logo,1) ++\
Trim(t0 +1,t1 ).NoLogoAuto(logo,1)++\
Trim(t1 +1,t2 ) ++\
Trim(t2 +1,t3 ).NoLogoAuto(logo,1)++\
Trim(t3 +1,t4 ) ++\
Trim(t4 +1,t5 ).NoLogoAuto(logo,1)++\
Trim(t5 +1,t6 ) ++\
Trim(t6 +1,t7 ).NoLogoAuto(logo,1)++\
Trim(t7 +1,t8 ) ++\
Trim(t8 +1,0 ).NoLogoAuto(logo,1)
ConvertToYV12()
LanczosResize(704,480,0,0,624,352)
AddBorders(8,0,8,0)
PS:
Okay, I localised the problem.
If I comment out either of the audio lines the batch encode works., i.e.:
AVISource("S60-122.avi").ConverttoYUY2()
EnsureVBRMP3Sync()
#AmplifydB(-3.0)
...
or
AVISource("S60-122.avi").ConverttoYUY2()
#EnsureVBRMP3Sync()
AmplifydB(-3.0)
...
will both work.
However, all of the other 7 files have these two lines, some with exactly the same AmplifydB value.
I've only started to use AVS audio recently, necessary if I use Trim() to cut and join sections. I use wavi.exe to extract the audio from the AVS, and that is very efficient.
So far quite reliable, but I have an odd problem.
(See PS at end for more details.)
This batch file below is what I use, just changing the bitrate and filenames. It puts all the parameters on the command line.
set rate=1710
set ar=16:9
::set ar=4:3
set hc=P:\HCenc\HCenc_022
set mpgd=s:\mpg\
for %%a in (
S60-115
S60-116
S60-117
S60-118
S60-119
S60-120
S60-121
S60-122
) do %hc% -i %~dp0%%a.avs -o %mpgd%%%a.m2v -b %rate% -aspectratio %ar% -pulldown -profile best -matrix qlb -frames 0 999999
This worked on the first 7 files, but then it crashed on the last, on about frame 72.
If I deleted all but the last filename and ran the batch, it crashed again.
But if I ran HCGui, and used exactly the same parameters, it proceeded successfully.
Here is the log for the crash:
-----------------------------------------
| HCenc - MPEG2 encoder - rel. 0.22.0.0 |
-----------------------------------------
MPEG profile@level: MP@ML
input: p:\dvd\s60-1c\s60-122.avs
output: s:\mpg\s60-122.m2v
--------------------
| encoder settings |
--------------------
profile: BEST
frames: 0 58984
framerate: 23.976
aspect ratio: 16:9
bitrate Kb/s: 1710
max. bitrate Kb/s: 8000
pulldown: yes, 23.976 --> 29.97
closed gops: no
VBV check: yes
scene change det.: yes
interlaced: no, BFF
goplen,B-pic: AUTO
dc_precision: 9
scan method: zigzag
bias: 0
chapter frames: 0
time code: 0 0 0 0
CPU: MMX
priority: idle
SMP active: no
matrix: QLB
luminance gain: no
------------------
| source stats |
------------------
nr. of frames in source: 58985
width*height: 720x480
fps: 23.976
nr. of frames to encode: 58985
frames to encode: 0 - 58984
==================================================
And here is the log for the HCGui run on the same AVS file:
-----------------------------------------
| HCenc - MPEG2 encoder - rel. 0.22.0.0 |
-----------------------------------------
MPEG profile@level: MP@ML
input: p:\dvd\s60-1c\s60-122.avs
output: S:\mpg\S60-122.m2v
--------------------
| encoder settings |
--------------------
profile: BEST
frames: 0 58984
framerate: 23.976
aspect ratio: 16:9
bitrate Kb/s: 1710
max. bitrate Kb/s: 8000
pulldown: yes, 23.976 --> 29.97
closed gops: no
VBV check: yes
scene change det.: yes
interlaced: no, BFF
goplen,B-pic: AUTO
dc_precision: 9
scan method: zigzag
bias: 0
chapter frames: 0
time code: 0 0 0 0
CPU: MMX
priority: idle
SMP active: no
matrix: QLB
luminance gain: no
------------------
| source stats |
------------------
nr. of frames in source: 58985
width*height: 720x480
fps: 23.976
nr. of frames to encode: 58985
frames to encode: 0 - 58984
---------------------
| encoding - pass 1 |
---------------------
pass 1 encoding time: 0:54:41 (3281.39 s)
fps: 18.0
--------------------------------
| encoding - intermediate pass |
--------------------------------
bitrate set to: 1710 kb/s
est. outfile length: 513536 kB
intermediate encoding time: 0.1 s
---------------------
| encoding - pass 2 |
---------------------
pass 2 encoding time: 0:53:07 (3186.53 s)
fps: 18.5
------------------
| encoding stats |
------------------
intra matrix used
8 16 19 22 26 27 29 34
16 16 22 24 27 29 34 37
19 22 26 27 29 34 37 39
22 22 26 27 29 34 38 42
22 26 27 29 32 36 40 50
26 27 29 32 36 40 50 61
26 27 29 35 40 50 59 75
27 29 35 40 50 59 75 89
non-intra matrix used
16 17 18 19 20 21 22 23
17 18 19 20 21 22 23 25
18 19 20 21 22 23 24 26
19 20 21 22 23 24 26 28
20 21 22 23 25 26 28 29
21 22 23 24 26 28 29 31
22 23 24 26 28 29 31 34
23 24 25 28 29 31 34 38
nr. of gops: 5209
nr. of frames: 58985
nr. of I-frames: 5209
nr. of P-frames: 15737
nr. of B-frames: 38039
average bitrate: 1710
minimum bitrate: 138
maximum bitrate: 4777
bytes in bitstream: 526610975
bits in bitstream: 4212887800
average Quantizer: 4.202
total CPU time: 1:45:15 (6315.20 s)
total elapsed time: 1:47:49 (6469.17 s)
==================================================
And here is the AVS file:AVISource("S60-122.avi").ConverttoYUY2()
EnsureVBRMP3Sync()
AmplifydB(-3.0)
#ShowFrameNumber(x=100,y=100)
logo=ImageSource("logo117.png").ConverttoYUY2()
t0=1299
t1=9803
t2=10567
t3=23526
t4=24306
t5=36163
t6=36884
t7=47504
t8=48270
#Trim(0 ,t0 ).NoLogoAuto(logo,1) ++\
Trim(t0 +1,t1 ).NoLogoAuto(logo,1)++\
Trim(t1 +1,t2 ) ++\
Trim(t2 +1,t3 ).NoLogoAuto(logo,1)++\
Trim(t3 +1,t4 ) ++\
Trim(t4 +1,t5 ).NoLogoAuto(logo,1)++\
Trim(t5 +1,t6 ) ++\
Trim(t6 +1,t7 ).NoLogoAuto(logo,1)++\
Trim(t7 +1,t8 ) ++\
Trim(t8 +1,0 ).NoLogoAuto(logo,1)
ConvertToYV12()
LanczosResize(704,480,0,0,624,352)
AddBorders(8,0,8,0)
PS:
Okay, I localised the problem.
If I comment out either of the audio lines the batch encode works., i.e.:
AVISource("S60-122.avi").ConverttoYUY2()
EnsureVBRMP3Sync()
#AmplifydB(-3.0)
...
or
AVISource("S60-122.avi").ConverttoYUY2()
#EnsureVBRMP3Sync()
AmplifydB(-3.0)
...
will both work.
However, all of the other 7 files have these two lines, some with exactly the same AmplifydB value.
I've only started to use AVS audio recently, necessary if I use Trim() to cut and join sections. I use wavi.exe to extract the audio from the AVS, and that is very efficient.