Mpeg Vs. 264 conversion question.

Random chit-chat and anything that doesn't belong elsewhere
Post Reply
Shane
Posts: 57
Joined: Thu Aug 25, 2016 2:47 am

Mpeg Vs. 264 conversion question.

Post by Shane » Fri Sep 23, 2016 2:04 pm

I recently purchased Video Mastering Works 6 by TMPGenc. I bought it for it's timeline editing functionality but it also easily exports Bluray Compliant Mpeg-2 and 264/AVC files.

It seems that when I do any editing be it basic sharpening, color correction, or anything, the output is always better when I choose Mpeg-2. In fact, it's incredible. I can convert interlaced video to progressive, alter frame rates, resize, and have no perceivable side effects such as choppy video which seems to be a problem when using 264/AVC even in Handbrake.

Mpeg-2 creates a huge file though so I've been creating a progressive Mpeg-2 file and then throwing it in to Handbrake to compress it.

Is VMW6's inability to produce a good 264 formatted file when converting i to P or 25fps to 29.97 a limitation of the codec or the program? I've experienced the same problems in Handbrake when doing the i-P and 25-29.97 conversion so I'm not convinced the problem is VMW6.

Thoughts? Input?

Thank you.

User avatar
JohnAStebbins
HandBrake Team
Posts: 5169
Joined: Sat Feb 09, 2008 7:21 pm

Re: Mpeg Vs. 264 conversion question.

Post by JohnAStebbins » Fri Sep 23, 2016 3:40 pm

We would have to see a HandBrake encode log to diagnose anything about your HandBrake encodes. Generally, if the source is clean, then the output will be clean as well. And I've never seen one video encoder produce jerky output while another doesn't. However, h.264 is more difficult to decode and you could be running into a problem with whatever player/decoder you are using to test you encodes.

Shane
Posts: 57
Joined: Thu Aug 25, 2016 2:47 am

Re: Mpeg Vs. 264 conversion question.

Post by Shane » Fri Sep 23, 2016 8:59 pm

I've been ripping some DVD's I own that aren't available on Bluray and transferring them them to Bluray. I can simply drag the .vob's to my authoring software and call it a day, but I like to increase their native w x h and add a 16:9 padding using HB's CLI. That way the size appears a bit smaller and the video appears a bit sharper.

The video comes out kind of choppy, even when I throw it on a USB drive and hook it directly to my TV bypassing my media player. I use VLC for viewing on my PC.

This CL creates a Bluray Complaint file. This is the log from that CL. Note: The test.m2ts file is from the original DVD rip. I shortened it losslessly (using Smart Render) using my authoring software to make the test quicker and it renamed it to an m2ts file.

Code: Select all

C:\hb>handbrakecli -i test.m2ts -o test.mkv --pad width=1920:height=1080 --custom-anamorphic --width 1440 --height 806 --rate 29.97 --cfr --decomb --deblock 5 --encoder x264 --encoder-preset veryslow --encoder-level 4.1 --quality 23 --encopts bluray-compat=1:vbv-maxrate=9800:vbv-bufsize=2240:keyint=24:open-gop=1:slices=4:colorprim=bt709:transfer=bt709:colormatrix=bt709c
[15:48:17] hb_init: starting libhb thread
[15:48:17] thread 4c1b410 started ("libhb")
HandBrake 20160913221443-8ee94cd-master (2016091401) - MinGW x86_64 - https://handbrake.fr
8 CPUs detected
Opening test.m2ts...
[15:48:17] CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
[15:48:17]  - Intel microarchitecture Skylake
[15:48:17]  - logical processor count: 8
[15:48:17] OpenCL: library not available
[15:48:17] Intel Quick Sync Video support: no
[15:48:17] hb_scan: path=test.m2ts, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:274: failed opening UDF image test.m2ts
src/libbluray/disc/disc.c:352: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:352: error opening file BDMV\BACKUP\index.bdmv
[15:48:17] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[15:48:17] dvd: not a dvd - trying as a stream/file instead
[15:48:17] file is MPEG Transport Stream with 192 byte packets offset 4 bytes
[15:48:17] Found the following PIDS
[15:48:17]     Video PIDS :
[15:48:17]       0x1011 type MPEG2 (0x2)
[15:48:17]     Audio PIDS :
[15:48:17]       0x1100 type AC3 (0x81)
[15:48:17]       0x1101 type AC3 (0x81)
[15:48:17]     Subtitle PIDS :
[15:48:17]     Other PIDS :
[15:48:17]       0x1001 type Unknown (0xff) (PCR)
[15:48:17] stream id 0x1100 (type 0x81 substream 0x0) audio 0x1100
[15:48:17] stream id 0x1101 (type 0x81 substream 0x0) audio 0x1101
[15:48:17] scan: decoding previews for title 1
[15:48:17] file is MPEG Transport Stream with 192 byte packets offset 4 bytes
[15:48:17] scan: audio 0x1101: ac3, rate=48000Hz, bitrate=384000 Unknown (AC3) (2.0 ch) (Dolby Surround)
[15:48:17] scan: audio 0x1100: ac3, rate=48000Hz, bitrate=448000 Unknown (AC3) (5.1 ch)
[15:48:17] stream: 16 good frames, 0 errors (0%)
[15:48:17] scan: 10 previews, 720x480, 23.976 fps, autocrop = 56/58/0/2, aspect 16:9, PAR 32:27
[15:48:17] libhb: scan thread found 1 valid title(s)
+ Using preset: CLI Default
+ title 1:
  + stream: test.m2ts
  + duration: 00:03:41
  + size: 720x480, pixel aspect: 32/27, display aspect: 1.78, 23.976 fps
  + autocrop: 56/58/0/2
  + support opencl: no
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:03:41
  + audio tracks:
    + 1, Unknown (AC3) (5.1 ch) (iso639-2: und), 48000Hz, 448000bps
    + 2, Unknown (AC3) (2.0 ch) (Dolby Surround) (iso639-2: und), 48000Hz, 384000bps
  + subtitle tracks:
[15:48:17] 1 job(s) to process
[15:48:17] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 128,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "av_aac",
                "Gain": 0.0,
                "Mixdown": "dpl2",
                "NormalizeMixLevel": false,
                "PresetEncoder": "av_aac",
                "Quality": -3.0,
                "Samplerate": "auto",
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac",
            "copy:ac3",
            "copy:eac3",
            "copy:dtshd",
            "copy:dts",
            "copy:mp3",
            "copy:truehd",
            "copy:flac"
        ],
        "FallbackEncoder": "av_aac"
    },
    "Destination": {
        "ChapterList": [
            {
                "Name": "Chapter 1"
            }
        ],
        "ChapterMarkers": false,
        "File": "test.mkv",
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": false
        },
        "Mux": "mkv"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 4,
                "Settings": {
                    "mode": "7"
                }
            },
            {
                "ID": 6,
                "Settings": {
                    "mode": 1,
                    "rate": "27000000/900900"
                }
            },
            {
                "ID": 7,
                "Settings": {
                    "qp": "5"
                }
            },
            {
                "ID": 11,
                "Settings": {
                    "crop-bottom": 58,
                    "crop-left": 0,
                    "crop-right": 2,
                    "crop-top": 56,
                    "height": 806,
                    "width": 1440
                }
            },
            {
                "ID": 14,
                "Settings": {
                    "height": "1080",
                    "width": "1920"
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 720,
        "Num": 853
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "test.m2ts",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "ColorMatrixCode": 0,
        "Encoder": "x264",
        "Level": "4.1",
        "OpenCL": false,
        "Options": "bluray-compat=1:vbv-maxrate=9800:vbv-bufsize=2240:keyint=24:open-gop=1:slices=4:colorprim=bt709:transfer=bt709:colormatrix=bt709c",
        "Preset": "veryslow",
        "Profile": "auto",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Quality": 23.0,
        "Tune": "",
        "Turbo": false,
        "TwoPass": false
    }
}
[15:48:17] starting job
[15:48:17] yadif thread started for segment 0
[15:48:17] yadif thread started for segment 1
[15:48:17] yadif thread started for segment 2
[15:48:17] yadif thread started for segment 3
[15:48:17] yadif thread started for segment 4
[15:48:17] yadif thread started for segment 5
[15:48:17] yadif thread started for segment 6
[15:48:17] yadif thread started for segment 7
[15:48:17] job configuration:
[15:48:17]  * source
[15:48:17]    + test.m2ts
[15:48:17]    + title 1, chapter(s) 1 to 1
[15:48:17]  * destination
[15:48:17]    + test.mkv
[15:48:17]    + container: Matroska (libavformat)
[15:48:17]  * video track
[15:48:17]    + decoder: mpeg2video
[15:48:17]      + bitrate 9800 kbps
[15:48:17]    + filters
[15:48:17]      + Decomb (mode=7)
[15:48:17]      + Framerate Shaper (mode=1:rate=27000000/900900)
[15:48:17]        + frame rate: 23.976 fps -> constant 29.970 fps
[15:48:17]      + Deblock (pp7) (qp=5)
[15:48:17]      + Crop and Scale (width=1440:height=806:crop-top=56:crop-bottom=58:crop-left=0:crop-right=2)
[15:48:17]        + source: 720 * 480, crop (56/58/0/2): 718 * 366, scale: 1440 * 806
[15:48:17]      + avfilter (pad='width=1920:height=1080:x=(out_w-in_w)/2:y=(out_h-in_h)/2')
[15:48:17]        + pad: width=1920, height=1080, x=(out_w-in_w)/2, y=(out_h-in_h)/2
[15:48:17]    + Output geometry
[15:48:17]      + storage dimensions: 1920 x 1080
[15:48:17]      + pixel aspect ratio: 853 : 720
[15:48:17]      + display dimensions: 2274 x 1080
[15:48:17]    + encoder: H.264 (libx264)
[15:48:17]      + preset:  veryslow
[15:48:17]      + options: bluray-compat=1:vbv-maxrate=9800:vbv-bufsize=2240:keyint=24:open-gop=1:slices=4:colorprim=bt709:transfer=bt709:colormatrix=bt709c
[15:48:17]      + profile: auto
[15:48:17]      + level:   4.1
[15:48:17]      + quality: 23.00 (RF)
[15:48:17]  * audio track 1
[15:48:17]    + decoder: Unknown (AC3) (5.1 ch) (track 1, id 0x1100)
[15:48:17]      + bitrate: 448 kbps, samplerate: 48000 Hz
[15:48:17]    + mixdown: Dolby Pro Logic II
[15:48:17]    + encoder: AAC (libavcodec)
[15:48:17]      + bitrate: 128 kbps, samplerate: 48000 Hz
[15:48:17] file is MPEG Transport Stream with 192 byte packets offset 4 bytes
[15:48:17] sync: expecting 5315 video frames
[15:48:17] x264 options: Bad argument colormatrix=bt709c
[15:48:17] encx264: min-keyint: 24, keyint: 24
[15:48:17] encx264: encoding at constant RF 23.000000
[15:48:17] encx264: unparsed options: bluray-compat=1:analyse=all:colormatrix=bt709c:open-gop=1:vbv-maxrate=9800:vbv-bufsize=2240:colorprim=bt709:b-adapt=2:transfer=bt709:keyint=24:trellis=2:slices=4:level=4.1:ref=4:subme=10:bframes=8:direct=auto:me=umh:merange=24:rc-lookahead=60
x264 [info]: using SAR=853/720
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
x264 [info]: profile High, level 4.1
[15:48:18] sync: first pts video is 0
[15:48:18] sync: first pts audio 0x1100 is 0
Encoding: task 1 of 1, 1.07 %[15:48:18] 2.068733s: Video -> Film
Encoding: task 1 of 1, 97.08 % (28.31 fps, avg 29.60 fps, ETA 00h00m05s)[15:51:12] hb_ts_stream_decode - eof
[15:51:12] reader: done. 1 scr changes
Encoding: task 1 of 1, 97.37 % (28.31 fps, avg 29.60 fps, ETA 00h00m05s)[15:51:15] work: average encoding speed for job is 29.595892 fps
Encoding: task 1 of 1, 97.37 % (28.31 fps, avg 29.60 fps, ETA 00h00m05s)[15:51:15] decomb: deinterlaced 5213 | blended 0 | unfiltered 0 | total 5213
[15:51:15] render: 6500 frames output, 0 dropped and 1287 duped for CFR/PFR
[15:51:15] render: lost time: 0 (0 frames)
[15:51:15] render: gained time: 0 (0 frames) (0 not accounted for)
[15:51:15] stream: 5213 good frames, 0 errors (0%)
[15:51:15] ac3-decoder done: 6777 frames, 0 decoder errors
[15:51:15] mpeg2video-decoder done: 5213 frames, 0 decoder errors
[15:51:15] sync: got 5213 frames, 5315 expected
[15:51:15] sync: framerate min 23.981 fps, max 29.970 fps, avg 24.035 fps
x264 [info]: frame I:299   Avg QP:15.53  size: 35258
x264 [info]: frame P:2326  Avg QP:19.66  size:  8861
x264 [info]: frame B:3875  Avg QP:23.53  size:  4189
x264 [info]: consecutive B-frames: 18.1%  3.2% 12.0% 66.7%
x264 [info]: mb I  I16..4: 54.5% 42.7%  2.8%
x264 [info]: mb P  I16..4:  2.0%  3.2%  0.1%  P16..4: 17.4%  2.5%  2.6%  0.0%  0.0%    skip:72.2%
x264 [info]: mb B  I16..4:  0.2%  0.3%  0.0%  B16..8: 19.1%  1.7%  0.3%  direct: 0.8%  skip:77.7%  L0:45.6% L1:50.9% BI: 3.5%
x264 [info]: 8x8 transform intra:48.3% inter:92.7%
x264 [info]: direct mvs  spatial:99.8% temporal:0.2%
x264 [info]: coded y,uvDC,uvAC intra: 30.5% 27.4% 2.7% inter: 3.3% 2.8% 0.0%
x264 [info]: i16 v,h,dc,p: 69%  9%  6% 16%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24%  9% 12%  7%  9% 12%  8% 11% 10%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 13%  6%  8% 11% 12% 10%  8%  8%
x264 [info]: i8c dc,h,v,p: 42% 23% 18% 17%
x264 [info]: Weighted P-Frames: Y:3.3% UV:0.9%
x264 [info]: ref P L0: 74.0% 12.9% 13.1%
x264 [info]: ref B L0: 92.2%  7.8%
x264 [info]: ref B L1: 92.4%  7.6%
x264 [info]: kb/s:1747.86
[15:51:15] mux: track 0, 6500 frames, 47367756 bytes, 1746.95 kbps, fifo 2048
[15:51:15] mux: track 1, 10164 frames, 3474419 bytes, 128.14 kbps, fifo 4096
[15:51:15] libhb: work result = 0

Encode done!

HandBrake has exited.

C:\hb>
Is there some de-interlace setting I'm missing, or is something turning on by default because I haven't specifically told HB via the CLI to turn it off?

fwiw, I did a quick test in the GUI version without using any of the Bluray Compliant settings I normally use and it came out really smooth, but I'm unable to throw that file on to a Bluray or resize it and add padding.

Feature Request: Please let us up-scale and add padding via the GUI. :wink:

User avatar
JohnAStebbins
HandBrake Team
Posts: 5169
Joined: Sat Feb 09, 2008 7:21 pm

Re: Mpeg Vs. 264 conversion question.

Post by JohnAStebbins » Fri Sep 23, 2016 10:09 pm

Code: Select all

[15:48:17]        + frame rate: 23.976 fps -> constant 29.970 fps
Is this necessary? I thought BD could do 23.976 progressive video. I would expect this to cause some slight unevenness in playback.
I also wouldn't enable the deblock filter unless your source clearly shows blocking. It's slow and degrades picture quality for video that does not have blocking artefacts.

I don't see anything that would cause large amounts of jitter. Depends on what you mean by "kind of choppy" but that could be the framerate conversion you are doing. Or it could just be that all your players are a little underpowered and can't keep up with HD h.264 decoding.

Shane
Posts: 57
Joined: Thu Aug 25, 2016 2:47 am

Re: Mpeg Vs. 264 conversion question.

Post by Shane » Fri Sep 23, 2016 10:35 pm

JohnAStebbins wrote:

Code: Select all

[15:48:17]        + frame rate: 23.976 fps -> constant 29.970 fps
Is this necessary? I thought BD could do 23.976 progressive video.
The problem with this video is it shows two different fps. It's the only DVD I own that shows up this way. I figured it would be better to deinterlace it to a higher fps since it seemed to come out worse if I set it to 23.976. On a side note, if you have more than one video on a single track in authoring software the fps has to match as well as the aspect ratio and that's another reason I often have to change fps.

These are the specs of the rip:

Code: Select all

ID : 1 
ID in the original source medium : 224 (0xE0) 
Format : MPEG Video 
Format version : Version 2 
Format profile : Main@Main 
Format settings, BVOP : Yes 
Format settings, Matrix : Custom 
Format settings, GOP : M=3, N=12 
Codec ID : V_MPEG2 
Codec ID/Info : MPEG 1 or 2 Video 
Duration : 1 h 52 min 
Bit rate mode : Variable 
Bit rate : 4 413 kb/s 
Maximum bit rate : 9 800 kb/s 
Width : 720 pixels 
Height : 480 pixels 
Display aspect ratio : 16:9 
Frame rate mode : Variable 
Frame rate : 23.976 (23976/1000) FPS 
Original frame rate : 29.970 (30000/1001) FPS 
Color space : YUV 
Chroma subsampling : 4:2:0 
Bit depth : 8 bits 
Compression mode : Lossy 
Bits/(Pixel*Frame) : 0.533 
Stream size : 3.47 GiB (84%) 
Language : English 
Default : No 
Forced : No 
Notice it shows two different fps and 720 x 480. When I load this file in to HB using the GUI version it shows it as 720 x 406. I don't know if that's because it is interlaced? It's the first video I've thrown at HB that does this so I'm a bit confused on that one. I always manually set Crop to all 0's and if I do that and uncheck 'keep aspect ratio' I can set the video to 720 x 480 but it's too tall.

But even with other files that show a single fps it will still be choppy.

The best way I can describe it is it looks like it's dropping a frame on a regular interval.

I've viewed them directly from the USB port on my TV, through the USB port on my Bluray player, and my PS4. Same results. Everything else plays fine. I can view the original rip just fine, it's only when I throw it in to HB or VMW6 and use h.264 to convert it to a progressive file that it does this.

Shane
Posts: 57
Joined: Thu Aug 25, 2016 2:47 am

Re: Mpeg Vs. 264 conversion question.

Post by Shane » Sun Sep 25, 2016 4:13 pm

Thanks for all the help. (cough cough) ;)

I got it figured out.

User avatar
JohnAStebbins
HandBrake Team
Posts: 5169
Joined: Sat Feb 09, 2008 7:21 pm

Re: Mpeg Vs. 264 conversion question.

Post by JohnAStebbins » Sun Sep 25, 2016 11:08 pm

Can you share your solution? Cause you stumped me :mrgreen:

musicvid
Veteran User
Posts: 3081
Joined: Sat Jun 27, 2009 1:19 am

Re: Mpeg Vs. 264 conversion question.

Post by musicvid » Wed Sep 28, 2016 3:28 am

That DVD is 23.976 that is flagged as 29.970, or something similar, I suspect.
That is why Same as Source works in HB, and guesswork does not. The higher fps is to be interpolated by a hardware player instead of a software encoder.

Shane
Posts: 57
Joined: Thu Aug 25, 2016 2:47 am

Re: Mpeg Vs. 264 conversion question.

Post by Shane » Thu Sep 29, 2016 2:04 am

JohnAStebbins wrote:Can you share your solution? Cause you stumped me :mrgreen:
It's as musicvid explained. After a ton of searching on this I came up with what he said. The only thing I ran in to was I had to set HB manually to 23.976 in the GUI version while I was doing my setting tests. If I chose 'Same As Source' it came out choppy.

I'm still confused by what MediaInfo showed me . . .

Code: Select all

Frame rate : 23.976 (23976/1000) FPS
Original frame rate : 29.970 (30000/1001) FPS
I took "Original frame rate" as, well, the original fps but it's actually the one labeled "Frame rate". Or, I should say, it only came out smooth when I manually set HBGUI to 23.976. Setting it to 'Same as original" came out choppy. I didn't think to check and see what fps it was coming out as when I selected 'Same as original'.

At any rate, this is the CL I ended up using to make it work. This changes the original image size to 1700 x 1000 and sets it in a 16:9 pad. It seems that --crop defaults to on/automatic. I had to add it and set it to 0's. This creates a Bluray compliant file.

Code: Select all

handbrakecli -i original.mkv -o output.mkv --pad width=1920:height=1080 --custom-anamorphic --width 1700 --height 1000 --crop 0:0:0:0 --rate 23.976 --cfr --no-decomb --no-detelecine --deblock 5 --no-grayscale --encoder x264 --encoder-preset veryslow --encoder-level 4.1 --quality 23 --encopts bluray-compat=1:vbv-maxrate=15000:vbv-bufsize=15000:keyint=24:open-gop=1:slices=4:colorprim=bt709:transfer=bt709:colormatrix=bt709

Post Reply