[FFmpeg-user] shuffleframes -- unexpected results

pdr0 pdr0 at shaw.ca
Mon Feb 22 06:06:13 EET 2021


pdr0 wrote
> Mark Filipak (ffmpeg) wrote
>> On 2021-02-21 21:39, pdr0 wrote:
>>> Mark Filipak (ffmpeg) wrote
>>>> I've run some test cases for the shuffleframes filter. I've documented
>>>> shuffleframes via my
>>>> preferred documentation format (below). In the course of my testing, I
>>>> found 2 cases (marked "*****
>>>> Expected", below) that produced unexpected results, to wit: If the 1st
>>>> frame is discarded, the
>>>> entire input is discarded, even if the 1st discard is followed by
>>>> frames
>>>> that are supposed to be
>>>> retained.
>>>>
>>>>                 -1 1    ...Blocks the pipeline (discards all frames).
>>>> *****
>>>> Expected 1 3 5 7 ..
>>>>                 -1 1 2   ...Blocks the pipeline (discards all frames).
>>>> ***** Expected 1 2 4 5 7 8 ..
>>> 
>>> These 2 cases produce the expected result for me
>>> 
>>> If the "entire input is discarded" - do you mean you get no output file
>>> at
>>> all ?
>> 
>> No output file at all. The transcodes complete (they don't hang awaiting
>> end-of-stream) but since 
>> the pipeline contains no frames, the encoder makes nothing and ffmpeg
>> makes no files.
>> 
>>> Post more info, including the console log
>> 
>> First, for context, the scripts:
>> ffmpeg -i 0.mkv -vf shuffleframes="-1" -dn "\-1.mkv"
>> ffmpeg -i 0.mkv -vf shuffleframes="-1 1" -dn "\-1 1.mkv"
>> ffmpeg -i 0.mkv -vf shuffleframes="-1 1 2" -dn "\-1 1 2.mkv"
>> 
>> I had to escape the '-' in the filenames in order to avoid this
>> complaint:
>> "Unrecognized option '1 1 2.mkv'.
>> "Error splitting the argument list: Option not found"
>> 
>> Perhaps it would be expeditious if you showed me your command line that
>> works, eh?
> 
> I didn't need to escape 
> 
> ffmpeg -i input.avs -vf shuffleframes="-1 1" -c:v libx264 -crf 20 -an
> out1.mkv
> ffmpeg -i input.avs -vf shuffleframes="-1 1 2" -c:v libx264 -crf 20 -an
> out2.mkv
> 
> input.avs is a 24.0fps blankclip with showframenumber() to overlay the
> framenumbers so I could examine the output later. 
> 
> (I noticed mp4 container does not work properly for this, there are
> duplicated frames, but mkv output is ok)
> 
> 
> 
> 
> Mark Filipak (ffmpeg) wrote
>> Oh dear. Is there a escaping row between Windows and ffmpeg? Here's the
>> logfile:
>> ffmpeg started on 2021-02-21 at 11:50:29
>> Report written to "ffmpeg-20210221-115029.log"
>> Log level: 32
>> Command line:
>> ffmpeg -i 0.mkv -vf "shuffleframes=-1 1 2" -dn "\\-1 1 2.mkv"
>> ffmpeg version N-100851-g9f38fac053 Copyright (c) 2000-2021 the FFmpeg
>> developers
>>    built with gcc 9.3-win32 (GCC) 20200320
>>    configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static
>> --pkg-config=pkg-config 
>> --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32
>> --enable-gpl --enable-version3 
>> --disable-debug --disable-w32threads --enable-pthreads --enable-iconv
>> --enable-zlib --enable-libxml2 
>> --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma
>> --enable-fontconfig 
>> --enable-opencl --enable-libvmaf --enable-vulkan --enable-libvorbis
>> --enable-amf --enable-libaom 
>> --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec
>> --enable-cuda-llvm 
>> --enable-libglslang --enable-libass --enable-libbluray
>> --enable-libmp3lame
>> --enable-libopus 
>> --enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx
>> --enable-libopencore-amrnb 
>> --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e
>> --enable-librubberband 
>> --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt
>> --enable-libsvtav1 
>> --enable-libtwolame --enable-libuavs3d --enable-libvidstab
>> --enable-libx264 --enable-libx26 
>> libavutil      56. 64.100 / 56. 64.100
>>    libavcodec     58.119.100 / 58.119.100
>>    libavformat    58. 65.101 / 58. 65.101
>>    libavdevice    58. 11.103 / 58. 11.103
>>    libavfilter     7.100.100 /  7.100.100
>>    libswscale      5.  8.100 /  5.  8.100
>>    libswresample   3.  8.100 /  3.  8.100
>>    libpostproc    55.  8.100 / 55.  8.100
>> Input #0, matroska,webm, from '0.mkv':
>>    Metadata:
>>      ENCODER         : Lavf58.65.101
>>    Duration: 00:00:05.76, start: 0.000000, bitrate: 295 kb/s
>>      Stream #0:0: Video: h264 (High), yuv420p(tv, smpte170m,
>> progressive),
>> 240x236 [SAR 32:27 DAR 
>> 640:531], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
>>      Metadata:
>>        ENCODER         : Lavc58.119.100 libx264
>>        DURATION        : 00:00:05.756000000
>>      Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp (default)
>>      Metadata:
>>        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES
>> NUMBER_OF_BYTES
>>        BPS-eng         : 80531
>>        DURATION-eng    : 00:00:05.736000000
>>        NUMBER_OF_FRAMES-eng: 338
>>        NUMBER_OF_BYTES-eng: 57741
>>        _STATISTICS_WRITING_APP-eng: mkvmerge v51.0.0 ('I Wish') 64-bit
>>        _STATISTICS_WRITING_DATE_UTC-eng: 2020-12-21 04:14:21
>>        ENCODER         : Lavc58.119.100 libvorbis
>>        DURATION        : 00:00:05.719000000
>> Stream mapping:
>>    Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
>>    Stream #0:1 -> #0:1 (vorbis (native) -> vorbis (libvorbis))
>> Press [q] to stop, [?] for help
>> [libvorbis @ 000001b0c4130a80] Queue input is backward in time
>> [libx264 @ 000001b0c2399140] using SAR=32/27
>> [libx264 @ 000001b0c2399140] using cpu capabilities: MMX2 SSE2Fast SSSE3
>> SSE4.2 AVX FMA3 BMI2 AVX2
>> [libx264 @ 000001b0c2399140] profile High, level 1.2, 4:2:0, 8-bit
>> [libx264 @ 000001b0c2399140] 264 - core 161 - H.264/MPEG-4 AVC codec -
>> Copyleft 2003-2020 - 
>> 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=7
>> lookahead_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=0 weightp=2 keyint=250 keyint_min=23
>> scenecut=40 intra_refresh=0 
>> rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69
>> qpstep=4 ip_ratio=1.40 aq=1:1.00
>> Output #0, matroska, to '\-1 1 2.mkv':
>>    Metadata:
>>      encoder         : Lavf58.65.101
>>      Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p(tv, smpte170m,
>> progressive), 240x236 [SAR 
>> 32:27 DAR 640:531], q=2-31, 23.98 fps, 1k tbn (default)
>>      Metadata:
>>        DURATION        : 00:00:05.756000000
>>        encoder         : Lavc58.119.100 libx264
>>      Side data:
>>        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
>>      Stream #0:1: Audio: vorbis (oV[0][0] / 0x566F), 48000 Hz, stereo,
>> fltp (default)
>>      Metadata:
>>        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES
>> NUMBER_OF_BYTES
>>        BPS-eng         : 80531
>>        DURATION-eng    : 00:00:05.736000000
>>        NUMBER_OF_FRAMES-eng: 338
>>        NUMBER_OF_BYTES-eng: 57741
>>        _STATISTICS_WRITING_APP-eng: mkvmerge v51.0.0 ('I Wish') 64-bit
>>        _STATISTICS_WRITING_DATE_UTC-eng: 2020-12-21 04:14:21
>>        DURATION        : 00:00:05.719000000
>>        encoder         : Lavc58.119.100 libvorbis
>> frame=    2 fps=0.0 q=0.0 size=       5kB time=00:00:00.36 bitrate=
>> 114.0kbits/s speed=13.7x
>> [libvorbis @ 000001b0c4130a80] Queue input is backward in time
>> frame=   92 fps=0.0 q=-1.0 Lsize=     174kB time=00:00:05.70 bitrate=
>> 250.0kbits/s speed=20.3x
>> video:112kB audio:55kB subtitle:0kB other streams:0kB global headers:4kB
>> muxing overhead: 4.748137%
>> [libx264 @ 000001b0c2399140] frame I:1     Avg QP:21.36  size:  1139
>> [libx264 @ 000001b0c2399140] frame P:25    Avg QP:23.08  size:  2331
>> [libx264 @ 000001b0c2399140] frame B:66    Avg QP:27.39  size:   821
>> [libx264 @ 000001b0c2399140] consecutive B-frames:  2.2%  6.5%  0.0%
>> 91.3%
>> [libx264 @ 000001b0c2399140] mb I  I16..4: 17.8% 78.7%  3.6%
>> [libx264 @ 000001b0c2399140] mb P  I16..4:  3.8% 19.1%  3.0%  P16..4:
>> 37.6% 21.5% 10.9%  0.0%  0.0% 
>>    skip: 4.2%
>> [libx264 @ 000001b0c2399140] mb B  I16..4:  0.8%  2.5%  0.9%  B16..8:
>> 38.6%  8.0%  2.7%  direct: 
>> 5.2%  skip:41.4%  L0:55.3% L1:35.3% BI: 9.5%
>> [libx264 @ 000001b0c2399140] 8x8 transform intra:70.4% inter:75.2%
>> [libx264 @ 000001b0c2399140] coded y,uvDC,uvAC intra: 53.9% 76.7% 21.0%
>> inter: 19.8% 25.2% 2.1%
>> [libx264 @ 000001b0c2399140] i16 v,h,dc,p: 47% 12% 19% 22%
>> [libx264 @ 000001b0c2399140] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 15% 18% 
>> 3%  5%  8%  5%  8%  4%
>> [libx264 @ 000001b0c2399140] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 21% 14% 
>> 6%  5%  6%  5% 10%  5%
>> [libx264 @ 000001b0c2399140] i8c dc,h,v,p: 47% 16% 33%  5%
>> [libx264 @ 000001b0c2399140] Weighted P-Frames: Y:28.0% UV:24.0%
>> [libx264 @ 000001b0c2399140] ref P L0: 57.0% 15.0% 19.1%  8.3%  0.5%
>> [libx264 @ 000001b0c2399140] ref B L0: 89.2%  8.5%  2.3%
>> [libx264 @ 000001b0c2399140] ref B L1: 97.9%  2.1%
>> [libx264 @ 000001b0c2399140] kb/s:159.04
>> 
>> =====
> 
> "[libvorbis @ 000001b0c4130a80] Queue input is backward in time" 
> 
> that might be a clue, but  it doesn't sound good . My test did not have
> audio
> 
> For the 1st "fail" case, it's 1/2 the frames, but same framerate, thus 1/2
> the duration, how does it handle audio ? or how do you want it to handle
> audio ?

Actually nothing to do with audio; I think it's your output path . Try an
explicit path. On windows you don't need escape or anything , just put it in
quotes if there are spaces



--
Sent from: http://ffmpeg-users.933282.n4.nabble.com/


More information about the ffmpeg-user mailing list