[FFmpeg-trac] #5440(avcodec:reopened): nvenc with interlace video never create packets with AV_PKT_FLAG_KEY
FFmpeg
trac at avcodec.org
Sat Mar 10 11:11:57 EET 2018
#5440: nvenc with interlace video never create packets with AV_PKT_FLAG_KEY
------------------------------------+------------------------------------
Reporter: maf | Owner:
Type: defect | Status: reopened
Priority: normal | Component: avcodec
Version: git-master | Resolution:
Keywords: nvenc | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+------------------------------------
Changes (by malakudi):
* status: closed => reopened
* resolution: invalid =>
Comment:
FFMPEG version used
{{{
ffmpeg
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
configuration: --disable-decoder=amrnb --disable-decoder=libopenjpeg
--disable-mips32r2 --disable-mips32r6 --disable-mips64r6 --disable-mipsdsp
--disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-libopencv
--disable-podpages --disable-stripping --enable-avfilter --enable-
avresample --enable-gcrypt --enable-gnutls --enable-gpl --enable-libass
--enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio
--enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-
libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-
libkvazaar --enable-libmp3lame --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-
libopenmpt --enable-libopus --enable-libpulse --enable-librubberband
--enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex
--enable-libtesseract --enable-libtheora --enable-libvidstab --enable-
libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx265
--enable-libxvid --enable-libzvbi --enable-nonfree --enable-opengl
--enable-openssl --enable-postproc --enable-pthreads --enable-shared
--enable-version3 --enable-libwebp --incdir=/usr/include/x86_64-linux-gnu
--libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --toolchain=hardened
--enable-frei0r --enable-chromaprint --enable-libx264 --enable-libiec61883
--enable-libdc1394 --enable-vaapi --disable-opencl --enable-libmfx
--disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options]
outfile}...
}}}
I have to reopen this ticket because there is still some underlying
problem with NVENC interlaced encoding. While outputing files (mkv, ts,
flv) has no issue and ffprobe correctly displays the keyframes in output
files, when outputing to flv with rtmp output or to hls output, keyframes
are not detected. Since testing flc with rtmp output is complicated, I
will only discuss the hls issue since if this is resolved, I guess it will
be resolved with flv rtmp as well.
Sample commands that show the issue:
{{{
ffmpeg -f mpegts -i sample.ts -flags +ildct+ilme -vcodec h264_nvenc
-preset slow -b:v 2200k -profile:v high -level 4.1 -c:a aac -ac 2 -b:a
128k -f mkv out.mkv
ffprobe -show_frames out.mkv 2> /dev/null | grep pict_type=I | wc -l
}}}
result: 6 key frames, all ok
{{{
ffmpeg -f mpegts -i sample.ts -flags +ildct+ilme -vcodec h264_nvenc
-preset slow -b:v 2200k -profile:v high -level 4.1 -c:a aac -ac 2 -b:a
128k -f mpegts out.ts
ffprobe -show_frames out.ts 2> /dev/null | grep pict_type=I | wc -l
}}}
result: 6 key frames, all ok
{{{
ffmpeg -f mpegts -i sample.ts -flags +ildct+ilme -vcodec h264_nvenc
-preset slow -b:v 2200k -profile:v high -level 4.1 -c:a aac -ac 2 -b:a
128k -f hls -hls_time 8 -hls_playlist_type vod playlist.m3u8
}}}
Command fails to split segments at first keyframe after 8 seconds
(hls_time 8) and creates only one ts file, called playlist0.ts, which as
we can see in next command:
ffprobe -show_frames playlist0.ts 2> /dev/null | grep pict_type=I | wc -l
results: 0 (no key frames)
{{{
ffmpeg -f mpegts -i sample.ts -flags +ildct+ilme -vcodec libx264 -preset
slow -b:v 2200k -profile:v high -level 4.1 -c:a aac -ac 2 -b:a 128k -f hls
-hls_time 8 hls_playlist_type vod playlistnew.m3u8
}}}
Same hls output but with libx264 as encoder results in correct splitting
on keyframes and a playlist with seven files (input is 62 seconds and
keyframe every 10 seconds, so 7 files). Every file has 1 keyframe.
{{{
for f in `ls playlistnew*ts` ; do ffprobe -show_frames $f 2> /dev/null |
grep pict_type=I | wc -l ; done
1
1
1
1
1
1
1
}}}
And finally, NVENC encoding to HLS without interlacing:
{{{
ffmpeg -f mpegts -i sample.ts -vcodec h264_nvenc -preset slow -b:v 2200k
-profile:v high -level 4.1 -c:a aac -ac 2 -b:a 128k -f hls -hls_time 8
-hls_playlist_type vod playlistprogressive.m3u8
}}}
Again, ffmpeg correctly creates 7 segments with one keyframe each.
So, the issue affects only NVENC interlaced encoding but not on standard
file output.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/5440#comment:12>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list