On Sat, May 28, 2011 at 5:32 AM, Ian Lynagh <[email protected]> wrote:
> On Fri, May 27, 2011 at 09:46:41PM -0700, Dan Dennedy wrote:
>>
>> Thanks for helping, Brian.
>
> Thanks to both of you!
>
>> >>I'm still having trouble rendering, though. I'd like to make a lossless
>> >>1080/50p profile, so I tried various things, e.g. using x264 with crf=0
>> >>(mentioned on http://mltframework.org/twiki/bin/view/MLT/ConsumerAvformat)
>>
>> FYI, these options are based on libavcodec v52. IOW, if you are using
>> a git version of ffmpeg since mid-April (v53), then some options are
>> different esp. for x264.
>
> Aha, that explains a lot of my confusion, ta. (I am indeed using a
> recent git/svn build of ffmpeg and melt).
>
>> >>In fact, even if I do
>> >>
>> >>    melt -verbose script003.sh.mlt -profile atsc_1080p_50 trellis=0 
>> >>-consumer avformat:/home/ian/kdenlive/untitled2.mp4 trellis=0 progress=1 
>> >>f=mp4 trellis=0 vcodec=libx264 trellis=0
>> >>
>> >>
>> >>the output includes "trellis=1", so I think I must be passing arguments
>> >>incorrectly?
>>
>> What do you mean? where do you see that "trellis=1" ?
>
> In the middle of the 6th line of output (the long line):
>
> $ melt -verbose z.mp4 -profile atsc_1080p_50 trellis=0 -consumer 
> avformat:z2.mp4 trellis=0 progress=1 f=mp4 trellis=0 vcodec=libx264 trellis=0
> libdc1394 error: Failed to initialize libdc1394
> [libx264 @ 0x1c81ea0] Default settings detected, using medium profile
> [libx264 @ 0x1c81ea0] using SAR=1/1
> [libx264 @ 0x1c81ea0] using cpu capabilities: MMX2 SSE2Fast FastShuffle 
> SSEMisalign LZCNT
> [libx264 @ 0x1c81ea0] profile High, level 4.2
> [libx264 @ 0x1c81ea0] 264 - core 115 r1995 c1e60b9 - H.264/MPEG-4 AVC codec - 
> Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 
> ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 
> mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 
> fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 
> interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 
> b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=1 weightp=2 keyint=250 
> keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 
> bitrate=200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 
> aq=1:1.00
> [producer avformat] audio: total_streams 1 max_stream 1 total_channels 2 
> max_channels 2
> [libx264 @ 0x1c81ea0] frame I:1     Avg QP:51.00  size:  6325
> [libx264 @ 0x1c81ea0] frame P:195   Avg QP:51.00  size:   535
> [libx264 @ 0x1c81ea0] frame B:12    Avg QP:51.00  size:    68
> [libx264 @ 0x1c81ea0] consecutive B-frames: 91.8%  0.0%  4.3%  3.8%
> [libx264 @ 0x1c81ea0] mb I  I16..4: 23.5% 76.5%  0.0%
> [libx264 @ 0x1c81ea0] mb P  I16..4:  0.1%  0.0%  0.0%  P16..4:  2.6%  0.1%  
> 3.4%  0.0%  0.0%    skip:93.8%
> [libx264 @ 0x1c81ea0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  
> 0.0%  direct: 0.0%  skip:100.0%  L0: 5.9% L1:94.1% BI: 0.0%
> [libx264 @ 0x1c81ea0] final ratefactor: 61.37
> [libx264 @ 0x1c81ea0] 8x8 transform intra:61.7% inter:100.0%
> [libx264 @ 0x1c81ea0] coded y,uvDC,uvAC intra: 7.3% 21.3% 0.0% inter: 0.0% 
> 0.0% 0.0%
> [libx264 @ 0x1c81ea0] i16 v,h,dc,p: 69% 24%  3%  4%
> [libx264 @ 0x1c81ea0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 67%  4% 24%  1%  1%  0%  
> 1%  0%  1%
> [libx264 @ 0x1c81ea0] i8c dc,h,v,p: 100%  0%  0%  0%
> [libx264 @ 0x1c81ea0] Weighted P-Frames: Y:0.0% UV:0.0%
> [libx264 @ 0x1c81ea0] ref P L0: 90.6%  0.1%  6.8%  2.5%
> [libx264 @ 0x1c81ea0] kb/s:214.18
>
>> >>Hmm, using cqp=0 looks a lot better, but still isn't lossless according
>> >>to ffmpeg -f framemd5.
>> >
>>
>> We can all use some help keeping up with ffmpeg options.
>
> I've now found ffmpeg's vpre flag and the lossless presets, but I'm
> still not getting lossless output with melt. I do with ffmpeg, though.
> Any idea what's going on?
>
> $ ffmpeg -i a.mp4 -vcodec libx264 -vpre lossless_ultrafast -acodec copy b.mp4
> $ melt a.mp4 -profile atsc_1080p_50 -consumer avformat:c.mp4 progress=1 f=mp4 
> acodec=copy vcodec=libx264 vpre=lossless_ultrafast threads=1 real_time=-1
> $ ffmpeg -i a.mp4 -f framemd5 a.txt
> $ ffmpeg -i b.mp4 -f framemd5 b.txt
> $ ffmpeg -i c.mp4 -f framemd5 c.txt
>
> $ diff -u a.txt b.txt
> [no output]
>
> $ diff -u a.txt c.txt | head
> --- a.txt       2011-05-28 12:16:51.000000000 +0000
> +++ c.txt       2011-05-28 12:17:15.000000000 +0000
> @@ -1,336 +1,208 @@
> -0, 0, 3110400, f8a658ca215247611e5b561e2315a263
> -1, 0, 18432, 166d882c459c2a735f621a0cf604b831
> -0, 1800, 3110400, f8a658ca215247611e5b561e2315a263
> -1, 2880, 18432, 0a9483912311ee02ace404b6b4ad8ff3
> -0, 3600, 3110400, 9523db3abcb1a53cffd03be049547a19
> -0, 5400, 3110400, 9523db3abcb1a53cffd03be049547a19
> -1, 5760, 18432, 32ef1b7df640fe5f076769328644409d
>

You can not md5sum comparisons between ffmpeg and melt. They are two
different programs. Melt is not as simple as ffmpeg and is more
proactive in the uncompressed domain. For starters, MLT converts the
YCbCr from 4:2:0 sub-samping to 4:2:2 and then back upon encoding. If
your input is interlaced and you requested progressive output through
the profile, then it is deinterlaced. There might be a rounding error
somewhere in the calculations for scaling and padding all inputs to
the profile.

> So ffmpeg is able to output losslessly, and the vpre option to melt does
> seem to be accepted: the quality is an awful lot better than without it,
> and this gets printed out:
>
> /home/ian/code/ffmpeg/inst/share/ffmpeg/libx264-lossless_ultrafast.ffpreset: 
> [ ref=1, coder=0, flags=+loop+cgop, cmp=+chroma, 
> partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8, me_method=dia, 
> subq=0, me_range=16, g=250, keyint_min=25, sc_threshold=40, i_qfactor=0.71, 
> b_strategy=1, qcomp=0.6, qmin=0, qmax=69, qdiff=4, directpred=1, 
> flags2=+fastpskip, cqp=0 ]
>
> File sizes are similar:
>
> $ ls -l b.mp4 c.mp4
> -rw-r--r-- 1 ian ian 107360855 May 28 12:15 b.mp4
> -rw-r--r-- 1 ian ian 106038268 May 28 12:16 c.mp4

So given the caveat above about incomparable md5sums, what else makes
you think it is not lossless?

> Here's the full -verbose output:
>
> $ melt -verbose a.mp4 -profile atsc_1080p_50 -consumer avformat:d.mp4 
> progress=1 f=mp4 acodec=copy vcodec=libx264 vpre=lossless_ultrafast threads=1 
> real_time=-1
> libdc1394 error: Failed to initialize libdc1394
> [consumer avformat] audio codec copy unrecognised - ignoring
> /home/ian/code/ffmpeg/inst/share/ffmpeg/libx264-lossless_ultrafast.ffpreset: 
> [ ref=1, coder=0, flags=+loop+cgop, cmp=+chroma, 
> partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8, me_method=dia, 
> subq=0, me_range=16, g=250, keyint_min=25, sc_threshold=40, i_qfactor=0.71, 
> b_strategy=1, qcomp=0.6, qmin=0, qmax=69, qdiff=4, directpred=1, 
> flags2=+fastpskip, cqp=0 ]
> [libx264 @ 0xd02f40] using SAR=1/1
> [libx264 @ 0xd02f40] using cpu capabilities: MMX2 SSE2Fast FastShuffle 
> SSEMisalign LZCNT
> [libx264 @ 0xd02f40] profile High 4:4:4 Predictive, level 4.2, bit depth 8
> [libx264 @ 0xd02f40] 64 - core 115 r1995 c1e60b9 - H.264/MPEG-4 AVC codec - 
> Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=0 
> ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=0 psy=0 mixed_ref=0 
> me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 
> chroma_qp_offset=0 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 
> bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 
> keyint_min=25 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
> [producer avformat] audio: total_streams 1 max_stream 1 total_channels 6 
> max_channels 6
> [libx264 @ 0xd02f40] frame I:1     Avg QP: 0.00  size:937147
> [libx264 @ 0xd02f40] frame P:207   Avg QP: 0.00  size:507721
> [libx264 @ 0xd02f40] mb I  I16..4: 65.1%  0.0% 34.9%
> [libx264 @ 0xd02f40] mb P  I16..4: 25.8%  0.0%  0.0%  P16..4: 23.0%  0.0%  
> 0.0%  0.0%  0.0%    skip:51.2%
> [libx264 @ 0xd02f40] coded y,uvDC,uvAC intra: 100.0% 99.1% 99.0% inter: 31.0% 
> 30.9% 30.9%
> [libx264 @ 0xd02f40] i16 v,h,dc,p: 66% 34%  0%  0%
> [libx264 @ 0xd02f40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 37%  2%  4%  6%  3%  
> 5%  3%  3%
> [libx264 @ 0xd02f40] i8c dc,h,v,p:  2% 30% 68%  0%
> [libx264 @ 0xd02f40] Weighted P-Frames: Y:0.0% UV:0.0%
> [libx264 @ 0xd02f40] kb/s:203914.09
>
>> > Your probably don't REALLY want lossless because the files will be HUGE.
>
> I think I do. I have a shiny new external disk to put it on, and I don't
> think my end result will be that long.
>
> Besides, I'd certainly like to understand how to make lossless output,
> even if I decide not to in the end.

Without md5sum, how do you confirm it?

-- 
+-DRD-+

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to