Re: [FFmpeg-user] Low latency H.264 streaming with ffmpeg
Greger Burman wrote > Observation: > x264 codec + mpegts format compared to mjpeg codec + mjpeg format adds > about 300 ms (10 frames) latency. Hi, I just started to transcode the 1-minute input video(mjpeg) from the USB camera with the below command. time ~/bin/ffmpeg -benchmark -threads 4 -t 00:01:00.00 -f video4linux2 -input_format mjpeg -framerate 30 -i /dev/video0 -an -c:v libx264 -preset ultrafast -tune zerolatency -thread_type 1 -r:v 30 -f null - Output: ffmpeg version 3.3 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 6.2.0 (Ubuntu 6.2.0-5ubuntu12) 20161005 configuration: --prefix=/usr --pkg-config-flags=--static --extra-cflags=-I/usr/include --extra-ldflags=-L/usr/lib --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-nonfree --enable-vaapi --enable-libopus --enable-libvpx --enable-hwaccel=h263_vaapi --enable-hwaccel=h264_vaapi --enable-hwaccel=mpeg2_vaapi --enable-hwaccel=mpeg4_vaapi --enable-hwaccel=vc1_vaapi --enable-hwaccel=vp8_vaapi --enable-hwaccel=vp9_vaapi --enable-hwaccel=wmv3_vaapi --enable-decoder='vp8,vp9' libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat57. 71.100 / 57. 71.100 libavdevice57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc54. 5.100 / 54. 5.100 Input #0, video4linux2,v4l2, from '/dev/video0': Duration: N/A, start: 5864.558330, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 640x480, 30 fps, 30 tbr, 1000k tbn, 1000k tbc Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264)) Press [q] to stop, [?] for help No pixel format specified, yuvj422p for H.264 encoding chosen. Use -pix_fmt yuv420p for compatibility with outdated media players. [libx264 @ 0x555b636ea220] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2 [libx264 @ 0x555b636ea220] profile High 4:2:2, level 3.0, 4:2:2 8-bit Output #0, null, to 'pipe:': Metadata: encoder : Lavf57.71.100 Stream #0:0: Video: h264 (libx264), yuvj422p(pc), 640x480, q=-1--1, 30 fps, 30 tbn, 30 tbc Metadata: encoder : Lavc57.89.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 frame= 1800 fps= 30 q=-1.0 Lsize=N/A time=00:01:00.00 bitrate=N/A speed= 1x video:8981kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown bench: utime=5.746s bench: maxrss=57952kB [libx264 @ 0x555b636ea220] frame I:8 Avg QP:19.12 size: 62426 [libx264 @ 0x555b636ea220] frame P:1792 Avg QP:22.09 size: 4853 [libx264 @ 0x555b636ea220] mb I I16..4: 100.0% 0.0% 0.0% [libx264 @ 0x555b636ea220] mb P I16..4: 1.5% 0.0% 0.0% P16..4: 58.3% 0.0% 0.0% 0.0% 0.0%skip:40.2% [libx264 @ 0x555b636ea220] coded y,uvDC,uvAC intra: 29.4% 66.3% 13.1% inter: 14.5% 42.2% 8.9% [libx264 @ 0x555b636ea220] i16 v,h,dc,p: 32% 38% 18% 12% [libx264 @ 0x555b636ea220] i8c dc,h,v,p: 36% 23% 31% 10% [libx264 @ 0x555b636ea220] kb/s:1226.19 real1m1.359s user0m5.772s sys 0m0.115s May I know the values (bench: utime=5.746s or user0m5.772s or sys 0m0.115s) I need to consider to measure the end-to-end transcoding latency? I am interested in measuring the combined encode and decode latency per video frame. Please suggest me. -- Sent from: http://www.ffmpeg-archive.org/ ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Audio Desynchronization When Utilizing Segmentation
> -rtbufsize 2147.48M -i audio="SPDIF/ADAT (1+2) (RME Fireface UC)" -map > 0:0,1:0 -map 1:0 -c:v h264_nvenc -preset: llhp ^ > > I believe only options from 19.0 - 19.1 in the ffmpeg documentation can be > applied on a per segment basis, correct me if I'm > wrong. > Sorry I don't mean to spam but a few quick corrections to my last sent message: I'm not sure where I got 19.0 - 19.1, I was referring to 2.0 - 2.1 in the formats documentation: https://www.ffmpeg.org/ffmpeg-formats.html I am also unsure how I managed to make one line in my block of code purple, it was an accident, it is of no significance. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Audio Desynchronization When Utilizing Segmentation
On Mon, Mar 26, 2018 at 7:27 AM, Jim Shupert wrote: > On 3/25/2018 9:30 PM, Gabriel Balaich wrote: > >> >> -i video="Video (00 Pro Capture HDMI 4K+)" >>> >>> a question - what is your capture card? > ___ > > It is the Magewell Pro Capture HDMI 4K Plus: http://www.magewell.com/pro-capture-hdmi-4k-plus Also just a few more updates, I assumed it was something to do with negative time stamps but that doesn't seem to be the case. After adding -segment_format_options avoid_negative_ts=make_zero the problem persists: ffmpeg -y -thread_queue_size -f dshow -video_size 3440x1440 -rtbufsize 2147.48M -framerate 100 -pixel_format nv12 ^ -itsoffset 00:00:00.015 -i video="Video (00 Pro Capture HDMI 4K+)" -thread_queue_size -guess_layout_max 0 -f dshow ^ -rtbufsize 2147.48M -i audio="SPDIF/ADAT (1+2) (RME Fireface UC)" -map 0:0,1:0 -map 1:0 -c:v h264_nvenc -preset: llhp ^ -pix_fmt nv12 -b:v 250M -minrate 250M -maxrate 250M -bufsize 250M -b:a 384k -ac 2 -r 100 -vsync 1 ^ -max_muxing_queue_size -f segment -segment_time 300 -segment_wrap 9 ^ -segment_format_options avoid_negative_ts=make_zero C:\Users\djcim\Videos\PC\PC\PC%02d.mp4 Unless when shifting a negative time stamp to zero it is also shifts other timestamps the same amount? I'm not really sure how to view time stamps, so it's hard for me to know this is having any effect at all. But if that is the case Maybe there is a way to route that format option to only audio (per segment), but options seem limited with -segment_format_options. Or I guess options seem limited in general when applying any type of "option" or effect per segment as opposed to the initial segment and nothing after. I believe only options from 19.0 - 19.1 in the ffmpeg documentation can be applied on a per segment basis, correct me if I'm wrong. When trying -segment_format_options async=1 for example it threw an error. Even if there was a way for me to slightly delay the audio per segment perhaps I could alleviate my issues to an extent, would be nice if I could find an actual fix though. I found a forum post on the "creative cow" forum by a user who seems to be experiencing the same thing as me: https://forums.creativecow.net/thread/291/1587 However he has a mic plugged into a camera directly, pulling video and audio from said camera, and is still experiencing audio drift when implementing segmentation. So I assume my issues have nothing to do with my audio and video streams coming from different sources. Unfortunately it seems no solution was found in this forum post. Every time I've thought that I hit a roadblock using ffmpeg I've always found a way forward, even after searching for fixes for weeks at time. I've been trying to figure out this last part for months, things are looking dismal. Any suggestions at all, even crazy ones, would be extremely appreciated. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Audio Desynchronization When Utilizing Segmentation
On 3/25/2018 9:30 PM, Gabriel Balaich wrote: -i video="Video (00 Pro Capture HDMI 4K+)" a question - what is your capture card? ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] FFplay and MPV can't play this video but Parole can
at 2018 Mar 25 11:31:22, Paul B Mahol (onemda at gmail.com) wrote: > Probably issue with your video drivers/device? I don't think it is related to such things, because I can play everything except this one. at 2018 Mar 25 20:47:54, Carl Eugen Hoyos (ceffmpeg at gmail.com) wrote: > Please upload a sample and post a link. Are you sure it is neccessary? I give enough information, I am using Debian 9.4 [code] $ mpv --version mpv 0.23.0 (C) 2000-2016 mpv/MPlayer/mplayer2 projects built on UNKNOWN ffmpeg library versions: libavutil 55.34.101 libavcodec 57.64.101 libavformat 57.56.101 libswscale 4.2.100 libavfilter 6.65.100 libswresample 2.3.100 ffmpeg version: 3.2.10-1~deb9u1 [/code] If it is really neccessary, please tell me how to cut first 3min of this video without lose its original data using ffmpeg? ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".