Stream records synchronization issue

Lee

New Member
Hello:
I am evaluating the software. Version: v. 0.5.28.2747 - 5.0.3530. I made a conference room for 2 participants and record video. When finished, both video are saved on server.
When I merge both videos using ffmpeg as described in the documentation:

ffmpeg -i stream1.mp4 -i stream2.mp4 -filter_complex "[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid];[0:a][1:a]amerge[a]"-map [vid] -map "[a]"-ac 2 -strict -2 -c:vlibx264 -crf 23 -preset veryfast output.mp4

It creates the output.mp4, but not syncronized. I configured the server with empty_shift_writer=true, restarted it
but still not sync the videos (elapsetime).

Other question: How to get the saved filename? I get the ID, but it's partial. Need to get both video filename.
The FFMPEG log is:


C:\teste>ffmpeg -i stream-d56e0481-5817-11e9-a446-1b99e2c8f0bf-u1d22q45n290fjrsb3gbquiboh.mp4 -i stream-cc3f1890-5817-11e9-b40c-ad91eb6b3c9b-tp02962avj31tv7i65l8i1tmj.mp4 -f lavfi -t 0.1 -i anullsrc -filter_complex "[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid];[0:a][1:a]amerge[a]" -map [vid] -map "[a]" -ac 2 -strict -2 -c:v libx264 -crf 23 -preset veryfast output.mp4
ffmpeg version N-91626-gf631c328e6 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20180813
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 19.100 / 56. 19.100
libavcodec 58. 23.100 / 58. 23.100
libavformat 58. 17.101 / 58. 17.101
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 26.100 / 7. 26.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000022f4cfdb800] st: 1 edit list: 1 Missing key frame while searching for timestamp: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000022f4cfdb800] st: 1 edit list 1 Cannot find an index entry before timestamp: 0.

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'stream-d56e0481-5817-11e9-a446-1b99e2c8f0bf-u1d22q45n290fjrsb3gbquiboh.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.59.106
Duration: 00:00:20.94, start: 0.000000, bitrate: 704 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 109 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:1(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc), 480x640, 586 kb/s, 30.01 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
Metadata:
handler_name : VideoHandler
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000022f4d0a4f80] st: 1 edit list: 1 Missing key frame while searching for timestamp: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000022f4d0a4f80] st: 1 edit list 1 Cannot find an index entry before timestamp: 0.

Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'stream-cc3f1890-5817-11e9-b40c-ad91eb6b3c9b-tp02962avj31tv7i65l8i1tmj.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.59.106
Duration: 00:00:41.73, start: 0.000000, bitrate: 212 kb/s
Stream #1:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 111 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #1:1(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240, 94 kb/s, 19.83 fps, 19.92 tbr, 90k tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #2, lavfi, from 'anullsrc':
Duration: N/A, start: 0.000000, bitrate: 705 kb/s
Stream #2:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
Stream mapping:
Stream #0:0 (aac) -> amerge:in0
Stream #0:1 (h264) -> pad
Stream #1:0 (aac) -> amerge:in1
Stream #1:1 (h264) -> overlay:eek:verlay
overlay -> Stream #0:0 (libx264)
amerge -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[Parsed_amerge_2 @ 0000022f4e8033c0] No channel layout for input 1
[Parsed_amerge_2 @ 0000022f4e8033c0] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
[libx264 @ 0000022f4d093f80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000022f4d093f80] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0000022f4d093f80] 264 - core 157 r2932 303c484 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=4 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=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=10 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, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.17.101
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuvj420p(pc, progressive), 960x640, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:
encoder : Lavc58.23.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.23.100 aac
frame= 1247 fps=452 q=-1.0 Lsize= 2289kB time=00:00:41.50 bitrate= 451.8kbits/s dup=208 drop=0 speed= 15x
video:1930kB audio:329kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.330162%
[libx264 @ 0000022f4d093f80] frame I:5 Avg QP:15.66 size: 22956
[libx264 @ 0000022f4d093f80] frame P:463 Avg QP:21.11 size: 3038
[libx264 @ 0000022f4d093f80] frame B:779 Avg QP:25.20 size: 584
[libx264 @ 0000022f4d093f80] consecutive B-frames: 14.4% 4.5% 7.0% 74.1%
[libx264 @ 0000022f4d093f80] mb I I16..4: 49.3% 22.9% 27.8%
[libx264 @ 0000022f4d093f80] mb P I16..4: 3.7% 4.7% 0.6% P16..4: 11.5% 4.1% 1.8% 0.0% 0.0% skip:73.6%
[libx264 @ 0000022f4d093f80] mb B I16..4: 0.4% 0.3% 0.0% B16..8: 4.2% 1.1% 0.1% direct: 1.1% skip:92.7% L0:46.3% L1:41.3% BI:12.4%
[libx264 @ 0000022f4d093f80] 8x8 transform intra:48.6% inter:24.4%
[libx264 @ 0000022f4d093f80] coded y,uvDC,uvAC intra: 35.9% 35.4% 7.1% inter: 1.6% 2.6% 0.2%
[libx264 @ 0000022f4d093f80] i16 v,h,dc,p: 45% 22% 16% 18%
[libx264 @ 0000022f4d093f80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 29% 19% 4% 4% 4% 4% 5% 5%
[libx264 @ 0000022f4d093f80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 20% 13% 6% 7% 7% 6% 7% 4%
[libx264 @ 0000022f4d093f80] i8c dc,h,v,p: 54% 19% 21% 6%
[libx264 @ 0000022f4d093f80] Weighted P-Frames: Y:0.2% UV:0.0%
[libx264 @ 0000022f4d093f80] kb/s:379.94
[aac @ 0000022f4d094d40] Qavg: 131.951

C:\teste>
 

Max

Administrator
Staff member
Hello.
Please update to latest WCS build from this page, version 5.0 is outdated.
To avoid missing keyframe please set the following parameter in WCS_HOME/conf/flashphoner.properties file
Code:
periodic_fir_request=true
Other question: How to get the saved filename? I get the ID, but it's partial. Need to get both video filename.
You can get stream recording file name by following ways:
1. Using WebSDK function Stream.getRecordInfo() on client side
2. Using REST API query
Code:
http://wcs:8081/rest-api/stream/find
{
"name":"stream1"
}
This returns the following
Code:
[
    {
        "appKey": "defaultApp", 
        ...
        "name": "stream1", 
        "record": true, 
        "recordName": "recordName.mp4",
        ...
    }
]
3. Using on_record_hook script as described here.
Note that you can define record file name as needed using template as described here.
 
  • Like
Reactions: Lee

Lee

New Member
Thanks for your help. It worked perfectly!
To finish this project and purchase a license, is there any way to put some caption on top and bottom of the syncronized video?
Need to put participant's name, date, time.
Found on older questions in this forum that need to transcode.
Sorry for this dumb question: what is to transcode?
Is it possibel, easier and faster to add the caption using FFMPEG?

Thanks
 
Top