Interlaced output

Hi,

I would like to stream interlaced output, no matter the input(progressive or interlaced).

My configuration looks like:

<configuration>
    <ffmpeg>
        <producer>
            <auto-deinterlace>none</auto-deinterlace>
            <threads>4</threads>
        </producer>
    </ffmpeg>
    <paths>
        <media-path>media/</media-path>
        <log-path disable="false">log/</log-path>
        <data-path>data/</data-path>
        <template-path>template/</template-path>
    </paths>
    <lock-clear-phrase>secret</lock-clear-phrase>
    <channels>
        <channel>
                <video-mode>1080i5000</video-mode>
                    <consumers>
                            <ffmpeg>
                                <path>udp://xxx.xxx.xxx.xxx:9094?pkt_size=1316&bitrate=8000000&overrun_nonfatal=1&fifo_size=300000&buffer_size=130000&localaddr=yyy.yyy.yyy</path>
                                <args>-format mpegts -codec:v h264_nvenc -codec:a aac</args>
                             </ffmpeg>
                    </consumers>
            </channel>
    </channels>

but the stream output is always progressive with 50fps.

Is this possible with CasparCG server (v2.4.0-beta1)?

I think the problem is the Nvidia hardware encoder that no more support the interlaced video encoding. try to use a softtware encoder.

I also suggest you to set ffmpeg setting deinterlace to ALL to avoid some issue on field order on some video codec.

The mixer always runs in progressive, you will need to tell ffmpeg to interlace the frames as part of the args

You are still using Nvidia codec, try -codec:v libx264

(sorry I can’t try it at the moment)

Andrea.

I tried with the ppa version of CasparCG server with above config and -codec:v libx264 option substitution, but the output is again progressive.

Hi again,

I am running successfully interlaced with h264_hvenc encoding using following script:

CHANNEL="Test Channel"          #Name of channel
MULTICAST="xxx.xxx.xxxx.xxxx:xxxx" #Output multicast group and port
LOCALIP="xx.xx.xx.xx"           #Local interface for multicast
PROVIDER="XXX"                  #Service provider               
PMT="201"                       #PMT PID
VPID="301"                      #VIDEO PID
APID="401"                      #AUDIO PID

FLAGS="-mpegts_flags +system_b -flush_packets 0"

/usr/local/bin/ffmpeg \
	-re \
	-stream_loop -1 \
	-i example.mp4 \
	-preset p7 \
	-profile:v high \
	-tune ll \
	-level 4.1 \
	-rc cbr \
	-b:v 7M \
	-bufsize 0.2M \
	-maxrate  7M \
	-minrate 7M \
	-bf 2 \
	-b_ref_mode middle \
	-temporal-aq 1 \
	-rc-lookahead 20 \
	-i_qfactor 0.75 \
	-b_qfactor 1.1 \
	-color_primaries bt709 \
	-colorspace bt709 \
	-color_trc bt709 \
	-muxrate 8M \
	-g 15 \
	-r 25 \
	-c:v h264_nvenc \
	-pix_fmt yuv420p \
	-flags ilme+ildct+cgop \
	-c:a aac \
	-b:a 256K \
	-ar 48000 \
	-bufsize:a 128K \
	-maxrate:a 256K \
	-minrate:a 256K \
    -metadata service_provider="$PROVIDEER" \
    -metadata service_name="$CHANNEL" \
    -mpegts_pmt_start_pid $PMT \
    -streamid 0:${VPID} \
    -streamid 1:${APID} \
    -f mpegts $FLAGS \
    -mpegts_service_type advanced_codec_digital_hdtv \
    "udp://${MULTICAST}?pkt_size=1316&bitrate=8000000&overrun_nonfatal=1&fifo_size=300000&buffer_size=130000&localaddr=${LOCALIP}"

I use a stream analyzer which produce what I expect:
SUCCESSFUL_INTERLACED_SCRIPT_CROP

I am applying the script above in the source code and the configuration, but produce progressive with 50 fps and channel positions: “Front: L C R, Side: L R, Back: L R, LFE” and matrix coefficients: “BT.601”, instead of interlaced with 25 fps and channel positions: “Front: L R” and Matrix coefficients: “BT.709”, Transfer characteristics: “BT.709”, Color primaries: “BT.709”, stream.

As you can see in the last screenshot the declared FPS are 25 but the Real are 50?

The option that make the stream interlaced is -flags ilme+ildct+cgop, but if I pass it in the args section it says Unused option flags=ilme+ildct+cgop. If I put this option in the ffmpeg_consumer.cpp:

enc->flags |= AV_CODEC_FLAG_INTERLACED_DCT;
enc->flags |= AV_CODEC_FLAG_INTERLACED_ME;
enc->flags |= AV_CODEC_FLAG_CLOSED_GOP;

it says “InitializeEncoder failed: invalid param (8) : Invalid Level.”

How can I do an interlaced output @Julusian @Andrea_08 ?

Any help is appreciated!

Hi Everybody,

I succeeded to start interlaced with hardware encoding as @Julusian proposed with following args:

<args>-format mpegts -filter:v format=pix_fmts=yuv420p,fps=50,interlace -flags:v +ilme+ildct -codec:v h264_nvenc -codec:a aac</args>

Thanks a lot!