[FFmpeg-user] Detecting frames on Raw video stream

Charl Wentzel charl.wentzel at vodamail.co.za
Thu Jul 14 22:48:39 EEST 2016



On 14/07/2016 19:55, Carl Eugen Hoyos wrote:
> Please try to concatenate the files from your original
> "perfect" try and feed the result into above FFmpeg
> command ("-" instead of "tcp://...").
> Does that work?
I concatenated the files into one big file then "piped" it in.  It works 
perfectly too.

$ cat test.all | ffmpeg -f image2pipe -vcodec rawvideo -pixel_format 
gray -frame_size 5038848 -video_size 2592x1944 -framerate 10 -i - 
-vcodec libx264 -x264opts sliced-threads -pix_fmt yuv420p -preset 
ultrafast -tune zerolatency -vsync cfr -g 10 -f mp4 test.mp4
ffmpeg version 2.7.6-0ubuntu0.15.10.1 Copyright (c) 2000-2016 the FFmpeg 
developers
   built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
   configuration: --prefix=/usr --extra-version=0ubuntu0.15.10.1 
--build-suffix=-ffmpeg --toolchain=hardened 
--libdir=/usr/lib/x86_64-linux-gnu 
--incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared 
--disable-stripping --enable-avresample --enable-avisynth 
--enable-frei0r --enable-gnutls --enable-ladspa --enable-libass 
--enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio 
--enable-libflite --enable-libfontconfig --enable-libfreetype 
--enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug 
--enable-libmp3lame --enable-libopenjpeg --enable-openal 
--enable-libopus --enable-libpulse --enable-librtmp 
--enable-libschroedinger --enable-libshine --enable-libspeex 
--enable-libtheora --enable-libtwolame --enable-libvorbis 
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid 
--enable-libzvbi --enable-opengl --enable-x11grab --enable-libdc1394 
--enable-libiec61883 --enable-libzmq --enable-libssh --enable-libsoxr 
--enable-libx264 --enable-libopencv --enable-libx265
   libavutil      54. 27.100 / 54. 27.100
   libavcodec     56. 41.100 / 56. 41.100
   libavformat    56. 36.100 / 56. 36.100
   libavdevice    56.  4.100 / 56.  4.100
   libavfilter     5. 16.101 /  5. 16.101
   libavresample   2.  1.  0 /  2.  1.  0
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  2.100 /  1.  2.100
   libpostproc    53.  3.100 / 53.  3.100
[image2pipe @ 0x1bcfb20] Stream #0: not enough frames to estimate rate; 
consider increasing probesize
Input #0, image2pipe, from 'pipe:':
   Duration: N/A, bitrate: N/A
     Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 2592x1944, 
10 tbr, 10 tbn, 10 tbc
[libx264 @ 0x1bdac40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x1bdac40] profile Constrained Baseline, level 5.0
[libx264 @ 0x1bdac40] 264 - core 146 r2555 0c21480 - H.264/MPEG-4 AVC 
codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - 
options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=4 
lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 
keyint=10 keyint_min=1 scenecut=0 intra_refresh=0 rc=crf mbtree=0 
crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'test.mp4':
   Metadata:
     encoder         : Lavf56.36.100
     Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), 
yuv420p, 2592x1944, q=-1--1, 10 fps, 10240 tbn, 10 tbc
     Metadata:
       encoder         : Lavc56.41.100 libx264
Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
frame=  164 fps= 28 q=19.0 Lsize=   34980kB time=00:00:16.40 
bitrate=17473.0kbits/s
video:34978kB audio:0kB subtitle:0kB other streams:0kB global 
headers:0kB muxing overhead: 0.007298%
[libx264 @ 0x1bdac40] frame I:17    Avg QP:16.24 size:505553
[libx264 @ 0x1bdac40] frame P:147   Avg QP:19.16 size:185183
[libx264 @ 0x1bdac40] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x1bdac40] mb P  I16..4: 12.9%  0.0%  0.0% P16..4: 42.9%  
0.0%  0.0%  0.0%  0.0%    skip:44.2%
[libx264 @ 0x1bdac40] coded y,uvDC,uvAC intra: 73.5% 0.0% 0.0% inter: 
30.6% 0.0% 0.0%
[libx264 @ 0x1bdac40] i16 v,h,dc,p: 25% 24% 26% 26%
[libx264 @ 0x1bdac40] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0x1bdac40] kb/s:17471.40

> I am assuming that those files were of constant size
> 5038848 bytes, are they?
Yes they are.  The concatenated file contains 164 frames and is exactly 
164 x 5,038,848 = 826,371,072 bytes

In addition to this I tried something else.  I changed the server 
software to only start transmitting packets after FFmpeg has connected.  
This ensures that FFmpeg sees the stream from the very first byte.  On 
top of this its a TCP connection so nothing should get lost.  But 
unfortunately the result is the same.
>> ffmpeg version 2.7.6-0ubuntu0.15.10.1
> Please understand that generally, only current FFmpeg
> git head is supported here.
Sorry, I'm using the version of FFmpeg in the Ubuntu 15.10 repositories.
Does it make a difference on this issue?


More information about the ffmpeg-user mailing list