[FFmpeg-user] video fps filter problem

홍석진 ssokjin.hong at navercorp.com
Tue Aug 14 12:42:06 EEST 2018


​Hi.
​
I have something to discuss with you about vf_fps.c in FFmpeg 4.
​
When I tried to encode a video which has only one video frame, a encoded video (result) had no video stream.
I used video fps filter to adjust fps from 25 to 12 (ffmpeg argument fps=fps=12.0000000000).
​
I know that vf_fps.c was newly rewritten in FFmpeg 4.
I tried to analyze vf_fps.c source code and finally realized that fps filter remove frame few conditions as below
/* There are two conditions where we want to drop a frame:
* - If we have two buffered frames and the second frame is acceptable
* as the next output frame, then drop the first buffered frame.
* - If we have status (EOF) set, drop frames when we hit the
* status timestamp. */​
In that case, video frame of my video contents can't be passed to ff_filter_frame function because this video contents has only one frame.
​
So, I wonder if I should think of this video as unusual. Because when I use FFmpeg 3, encoded result video has video stream.
​
See original video metadata extracted by ffprobe (ffprobe -select_streams v:0 -show_frames issue_cnts​.mp4)

 
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue_cnts​.mp4':
Metadata:
major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2mp41
encoder         : Lavf57.25.100
Duration: 00:04:34.69, start: 0.000000, bitrate: 129 kb/s
Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 5726 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc (default)
Metadata:
handler_name    : VideoHandler
Stream #0:1(eng): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
Metadata:
handler_name    : SoundHandler
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=512
pkt_duration_time=0.040000
pkt_pos=44
pkt_size=28633
width=1280
height=720
pix_fmt=yuv420p
sample_aspect_ratio=1:1
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]​


​
And here is ffmpeg log

 ./ffmpeg -i "issue_cnts.mp4" -c:v libx264 -vf fps=fps=12.0000000000 -c:a libfdk_aac -sn -f mp4 -max_muxing_queue_size 20000 -max_interleave_delta 0 -chunk_duration 500000 "result.mp4"
​
ffmpeg version N-91601-g551a029 Copyright (c) 2000-2018 the FFmpeg developers
 built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-16)
 configuration: --bindir=/home1/irteam/apps/bin --disable-manpages --enable-gpl --enable-nonfree --enable-static --enable-debug --enable-libfdk-aac --enable-libx264 --enable-libx265 --disable-decoder=amrnb --disable-decoder=amrwb --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-runtime-cpudetect --disable-shared --enable-avresample --disable-devices --disable-ffplay --disable-demuxer=hls --enable-indev=lavfi --enable-libfreetype --ld=g++ --pkg-config-flags=--static --extra-cflags=-Ofast --extra-cxxflags='-std=c++11 -Ofast'
 libavutil      56. 19.100 / 56. 19.100
 libavcodec     58. 22.101 / 58. 22.101
 libavformat    58. 17.101 / 58. 17.101
 libavdevice    58.  4.101 / 58.  4.101
 libavfilter     7. 26.100 /  7. 26.100
 libavresample   4.  0.  0 /  4.  0.  0
 libswscale      5.  2.100 /  5.  2.100
 libswresample   3.  2.100 /  3.  2.100
 libpostproc    55.  2.100 / 55.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue_cnts.mp4':
 Metadata:
   major_brand     : isom
   minor_version   : 512
   compatible_brands: isomiso2mp41
   encoder         : Lavf57.25.100
 Duration: 00:04:34.69, start: 0.000000, bitrate: 129 kb/s
   Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 5726 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc (default)
   Metadata:
     handler_name    : VideoHandler
   Stream #0:1(eng): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
   Metadata:
     handler_name    : SoundHandler
Stream mapping:
 Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
 Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[libx264 @ 0x3edf980] using SAR=1/1   0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A
[libx264 @ 0x3edf980] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x3edf980] profile High, level 3.1
Output #0, mp4, to 'result.mp4':
 Metadata:
   major_brand     : isom
   minor_version   : 512
   compatible_brands: isomiso2mp41
   encoder         : Lavf58.17.101
   Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 12 fps, 12288 tbn, 12 tbc (default)
   Metadata:
     handler_name    : VideoHandler
     encoder         : Lavc58.22.101 libx264
   Side data:
     cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
   Stream #0:1(eng): Audio: aac (libfdk_aac) (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 128 kb/s (default)
   Metadata:
     handler_name    : SoundHandler
     encoder         : Lavc58.22.101 libfdk_aac
frame=    0 fps=0.0 q=0.0 Lsize=    4442kB time=00:04:34.69 bitrate= 132.5kbits/s speed=32.2x
video:0kB audio:4303kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.241078%​


​
encoded (result) video metadata (ffprobe -show_streams result.mp4)

 
ffprobe version 3.0 Copyright (c) 2007-2016 the FFmpeg developers
 built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
 configuration: --bindir=/home1/irteam/apps/bin --disable-manpages --enable-gpl --enable-nonfree --enable-static --enable-debug --enable-libfdk-aac --enable-libx264 --enable-libx265 --disable-decoder=amrnb --disable-decoder=amrwb --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-runtime-cpudetect --disable-shared --enable-avresample --disable-devices --disable-ffplay --disable-ffserver --ld=g++ --extra-cxxflags='-std=c++11'
 libavutil      55. 17.103 / 55. 17.103
 libavcodec     57. 24.102 / 57. 24.102
 libavformat    57. 25.100 / 57. 25.100
 libavdevice    57.  0.101 / 57.  0.101
 libavfilter     6. 31.100 /  6. 31.100
 libavresample   3.  0.  0 /  3.  0.  0
 libswscale      4.  0.100 /  4.  0.100
 libswresample   2.  0.101 /  2.  0.101
 libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'result_401.mp4':
 Metadata:
   major_brand     : isom
   minor_version   : 512
   compatible_brands: isomiso2avc1mp41
   encoder         : Lavf58.17.101
 Duration: 00:04:34.74, start: 0.046440, bitrate: 132 kb/s
   Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
   Metadata:
     handler_name    : SoundHandler
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=-2048
start_time=-0.046440
duration_ts=12115899
duration=274.736939
bit_rate=128299
max_bit_rate=128299
bits_per_raw_sample=N/A
nb_frames=11832
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:language=eng
TAG:handler_name=SoundHandler
[/STREAM]​


​
​
Regards.
​​





More information about the ffmpeg-user mailing list