Log in

View Full Version : Getting --demuxer lavf to work


MrVideo
29th September 2017, 07:04
Background: Need to recode H.264/4:2:2 video to H.264/4:2:0 video

Source test video is here (http://vidiot.com/CW-H264-test-good-170924-422.ts). Approx 100MB

Script that is run (cygwin XP-64 xterm):
x264 --demuxer lavf --input-csp i420 --input-res 1920x1080 --fps 29.97 \
--profile high --level 4.0 --bitrate 8000 --ref 4 \
--deblock 1:-1:-1 --me umh --subme 10 --psy-rd 1.00:0.15 --merange 24 \
--trellis 2 --deadzone-inter 21 --deadzone-intra 11 --fast-pskip \
--threads 12 --slices 4 --nr 0 --bframes 3 --b-pyramid strict \
--b-adapt 2 --b-bias 0 --direct auto --weightp 0 --keyint 30 \
--min-keyint 1 --scenecut 40 --rc-lookahead 60 --ratetol 1.0 \
--qcomp 0.60 --qpmin 10 --qpmax 51 --qpstep 4 --cplxblur 20.0 \
--qblur 0.5 --vbv-maxrate 16000 --vbv-bufsize 16000 \
--ipratio 1.40 --bluray-compat --open-gop --tff --sar 1:1 \
--output 0001_output.h264 CW-H264-test-good-170924-422.ts

Resulting output:
[h264 @ 038d41a0] SPS unavailable in decode_picture_timing
[h264 @ 038d41a0] non-existing PPS 0 referenced
[h264 @ 038d41a0] SPS unavailable in decode_picture_timing
[h264 @ 038d41a0] non-existing PPS 0 referenced
[h264 @ 038d41a0] decode_slice_header error
[h264 @ 038d41a0] no frame!
{repeat 51 more times}
[mpegts @ 003f53a0] PES packet size mismatch
[mpegts @ 003f53a0] PES packet size mismatch
[mpegts @ 003f53a0] PES packet size mismatch
[mpegts @ 003f53a0] PES packet size mismatch
[h264 @ 003fe3a0] Missing reference picture, default is 2147483647
[h264 @ 003fe3a0] Missing reference picture, default is 2147483647
[h264 @ 003fe3a0] Missing reference picture, default is 65428
[h264 @ 003fe3a0] Missing reference picture, default is 65428
lavf [info]: 1920x1080i 1:1 @ 30000/1001 fps (cfr)
resize [warning]: converting from yuv422p to yuv420p
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT
x264 [info]: profile High, level 4.0
[mpegts @ 003f53a0] PES packet size mismatch
[mpegts @ 003f53a0] PES packet size mismatch
[mpegts @ 003f53a0] PES packet size mismatch
[mpegts @ 003f53a0] PES packet size mismatch
x264 [info]: frame I:46 Avg QP:10.37 size: 16633
x264 [info]: frame P:328 Avg QP:11.80 size: 436
x264 [info]: frame B:936 Avg QP:16.14 size: 211
x264 [info]: consecutive B-frames: 2.7% 1.7% 13.5% 82.1%
x264 [info]: mb I I16..4: 74.5% 23.1% 2.4%
x264 [info]: mb P I16..4: 0.5% 0.1% 0.0% P16..4: 0.8% 0.0% 0.0% 0.0% 0.0% skip:98.5%
x264 [info]: mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.9% 0.1% 0.0% direct: 0.0% skip:99.0% L0:41.0% L1:57.9% BI: 1.1%
x264 [info]: final ratefactor: -26.55
x264 [info]: field mbs: intra: 0.0% inter:0.0% skip:0.0%
x264 [info]: 8x8 transform intra:22.9% inter:46.2%
x264 [info]: direct mvs spatial:99.4% temporal:0.6%
x264 [info]: coded y,uvDC,uvAC intra: 2.0% 3.6% 3.2% inter: 0.0% 0.0% 0.0%
x264 [info]: i16 v,h,dc,p: 93% 6% 0% 0%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 74% 1% 26% 0% 0% 0% 0% 0% 0%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 23% 23% 2% 2% 3% 1% 2% 2%
x264 [info]: i8c dc,h,v,p: 83% 7% 10% 0%
x264 [info]: ref P L0: 77.0% 22.9% 0.1%
x264 [info]: ref B L0: 95.0% 5.0%
x264 [info]: ref B L1: 94.9% 5.1%
x264 [info]: kb/s:202.38

encoded 1310 frames, 38.35 fps, 202.38 kb/s
The --input-csp can be i422. It doesn't make a difference.

The output is on 1MB and black. It should be ~61% smaller than the original.

Any help in getting this working will be appreciated.

Sharc
29th September 2017, 08:43
Download is too slow.
Can you zip your file and upload it to a filehoster with reasonable download speed (mediafire, megaupload ...)?

I think --input-csp expects a string, like --input-csp "i420".

sneaker_ger
29th September 2017, 09:31
For me it encodes with the actual picture, not black. I'm using komisar's build. But the file is also small. It seems this test picture is too easy to compress. Are you sure the black picture is not an error of your playback software?

P.S.: --input-csp and --input-res are only needed when the input is uncompressed

Sharc
29th September 2017, 11:02
ok, I got your file eventually.
Same as sneaker_ger. It encodes successfully (with the warnings etc).
Encoded file size is 295k with commandline:
x264.exe --preset medium --bluray-compat --crf 20 --tff --fps 29.97 --vbv-bufsize 30000 --vbv-maxrate 40000 --output "out.264" "c:\Program Files Video\x264_testbed\CW-H264-test-good-170924-422.ts"
It plays as expected.
Maybe you should just re-mux the .264 output with tsmuxer for viewing with your playback SW; or remux it with tsmuxer before encoding (reduces the 100MB to 7 MB by stripping off the two Dolby E audio and the EIA-608/708 tracks).

MrVideo
29th September 2017, 13:16
Download is too slow.
Sorry, the Spectrum internet is 60Mbps down, but a slow 4Mbps up.

Glad that you got it.

MrVideo
29th September 2017, 13:20
For me it encodes with the actual picture, not black.
Sorry, totally forgot that VLC doesn't like H.264 elementary stream files.
I'm using komisar's build.
I have no idea what that is. The x264 version, must run under XP-64.
But the file is also small. It seems this test picture is too easy to compress.
It is a test of concept file. I have more complex files in which to put through its paces.
P.S.: --input-csp and --input-res are only needed when the input is uncompressed
Thanks, I'll remove those from my script.

MrVideo
29th September 2017, 13:39
ok, I got your file eventually.
Same as sneaker_ger. It encodes successfully (with the warnings etc).
Encoded file size is 295k with commandline:
x264.exe --preset medium --bluray-compat --crf 20 --tff --fps 29.97 \
--vbv-bufsize 30000 --vbv-maxrate 40000 --output "out.264" \
"c:\Program Files Video\x264_testbed\CW-H264-test-good-170924-422.ts"
It plays as expected.
Ya, once I remuxed the new video with the MP2 audio streams (TSMuxer doesn't like Dolby-E streams), it plays just fine.
Maybe you should just re-mux the .264 output with tsmuxer for viewing with your playback SW; or remux it with tsmuxer before encoding (reduces the 100MB to 7 MB by stripping off the two Dolby E audio and the EIA-608/708 tracks).
Actually it is a single Dolby-E stream. I should have removed it before uploading. Sorry about that. When I get things going, the Dolby-E is extracted and ultimately recoded to AC3 5.1.

I see that the --demuxer isn't needed either.

I really like the x264 program. I've been using it for years and have barely touched the surface as to what it can do.

Thanks for responding. If it wouldn't have been for the stupid mistake of trying to get VLC to play an H.264 ES file, I wouldn't have learned that options I was using are not needed.