0

i've transcoded an interlaced JPEG2000 video file to H.264 using ffmpeg. following the guidelines, i constructed the following command line:

ffmpeg -hide_banner -i $input \
        -vf tinterlace=0 \
        -c:v libx264 -crf 0 -qp 0 -preset veryslow \
        -x264-params interlaced=1 -flags +ildct+ilme \
        -profile:v high444 \
        -map 0 -c:a aac -c:d copy -c:s copy -c:t copy -y $output

here is part of the mediainfo report of the resulting video (non-video tracks excluded for brevity):

General
Complete name                            : output.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 263 MiB
Duration                                 : 1 min 0 s
Overall bit rate                         : 36.8 Mb/s
Writing application                      : Lavf60.3.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High 4:2:2@L4
Format settings                          : CABAC / 16 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 16 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 1 min 0 s
Bit rate                                 : 36.5 Mb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 10 bits
Scan type                                : MBAFF
Scan type, store method                  : Interleaved fields
Scan order                               : Top Field First
Bits/(Pixel*Frame)                       : 3.523
Stream size                              : 261 MiB (99%)
Writing library                          : x264 core 164 r3106 eaa68fa
Encoding settings                        : cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=18 / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=tff / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=0 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=0.0 / qcomp=0.60 / qpmin=0 / qpmax=81 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Color range                              : Full

my question is: is there a way to tell if the resulting output file truly is lossless? (there is no output line that says 'lossless' in the ffmpeg output nor in the mediainfo report on the file.)

[NB - even though it might not be common modern practice to create interlaced video, the output video needs to preserve interlacing because it's part of The Requirements®.]

1 Answer 1

1

Just do this:

ffmpeg -i $input -i $output -lavfi ssim -f null -

This will compare the two videos using SSIM. If it's lossless then you will see:

SSIM Y:1.000000 (inf) U:1.000000 (inf) V:1.000000 (inf) All:1.000000 (inf)

You don't need both -qp 0 and -crf 0 btw. The latter is lossless if the input is 8-bit. The former always is. Also you don't need to set a profile manually. FFmpeg will pick the right profile for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.