On 15/01/2016 10:52, Moritz Barsnick wrote:
On Fri, Jan 15, 2016 at 10:11:09 +0100, Moritz Barsnick wrote:
Would it be worth an attempt to add an option to ffmpeg to take the
timestamps from "arrival time" (time of day)? I'll have a look at this
- sometime.
Oh, sorry, that option does exist: "-use_wallclock_as_timestamps".

If I record my incoming MJPEG multipart/alternative HTTP stream with
"-re -use_wallclock_as_timestamps 1", the timestamps look okay, though
astonishingly quite strictly aligned to full seconds. (My stream can
vary between 1 fps and 5 fps.)


Using "-re -use_wallclock_as_timestamps 1" seems right, but sadly it trigger some «Non-monotonous DTS» warning message, and the resulting video now plays too slowly. But this time the fps recorded is 16.52 fps which is better than the 25 of before :

ffmpeg -y -thread_queue_size 1024 -f s16le -ar -i tcp://localhost:5419?listen=1 -re -use_wallclock_as_timestamps 1 -f mjpeg -thread_queue_size 1024 -i -c:v libx264 -preset veryfast -crf 28 -vsync 0 -strict -2 -acodec aac -threads 0 -ar 44100 file.mp4

WARNING: linker: libx264.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (GCC)
  configuration: --arch=arm --target-os=android --enable-cross-compile
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.0 : mono
Input #0, s16le, from 'tcp://localhost:32112?listen=1':
  Duration: N/A, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, 1 channels, s16, 705 kb/s
[mjpeg @ 0xb6427c00] Changeing bps to 8
Input #1, mjpeg, from 'pipe:':
  Duration: N/A, start: 1452870978.041862, bitrate: N/A
Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 720x480 [SAR 1:1 DAR 3:2], 25 tbr, 1200k tbn, 25 tbc
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0xb6428800] using SAR=1/1
[libx264 @ 0xb6428800] using cpu capabilities: ARMv6 NEON
[libx264 @ 0xb6428800] profile High, level 3.0
[libx264 @ 0xb6428800] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:-1:-1 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.15 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=6 lookahead_threads=2 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=28.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/storage/emulated/0/DCIM/AMA/NP/record/./test.mp4':
  Metadata:
    encoder         : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 720x480 [SAR 1:1 DAR 3:2], q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.60.100 libx264
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc56.60.100 aac
Stream mapping:
  Stream #1:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
[libx264 @ 0xb6428800] non-strictly-monotonic PTS
    Last message repeated 1 times
frame=    8 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
[libx264 @ 0xb6428800] non-strictly-monotonic PTS
    Last message repeated 1 times
frame=   16 fps= 15 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
[libx264 @ 0xb6428800] non-strictly-monotonic PTS
frame= 24 fps= 15 q=32.0 size= 0kB time=00:00:00.12 bitrate= 3.2kbits/s [mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 2560, current: 2560; changing to 2561. This may result in incorrect timestamps in the output file.
[libx264 @ 0xb6428800] non-strictly-monotonic PTS
    Last message repeated 1 times
[mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 6656, current: 6656; changing to 6657. This may result in incorrect timestamps in the output file. [libx264 @ 0xb6428800] non-strictly-monotonic PTS q=30.0 size= 43kB time=00:00:00.68 bitrate= 521.5kbits/s
    Last message repeated 1 times
[mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 11776, current: 11776; changing to 11777. This may result in incorrect timestamps in the output file.
[libx264 @ 0xb6428800] non-strictly-monotonic PTS
[mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 13824, current: 13824; changing to 13825. This may result in incorrect timestamps in the output file. frame= 38 fps= 15 q=38.0 size= 71kB time=00:00:01.12 bitrate= 521.6kbits/s
[libx264 @ 0xb6428800] non-strictly-monotonic PTS
[mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 18944, current: 18944; changing to 18945. This may result in incorrect timestamps in the output file. frame= 45 fps= 14 q=33.0 size= 88kB time=00:00:01.60 bitrate= 451.9kbits/s [mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 24064, current: 24064; changing to 24065. This may result in incorrect timestamps in the output file.
[libx264 @ 0xb6428800] non-strictly-monotonic PTS
    Last message repeated 1 times
[mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 26112, current: 26112; changing to 26113. This may result in incorrect timestamps in the output file. [libx264 @ 0xb6428800] non-strictly-monotonic PTS q=30.0 size= 114kB time=00:00:02.16 bitrate= 433.7kbits/s [mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 28672, current: 28672; changing to 28673. This may result in incorrect timestamps in the output file.
[libx264 @ 0xb6428800] non-strictly-monotonic PTS
[mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 28673, current: 28672; changing to 28674. This may result in incorrect timestamps in the output file.
[libx264 @ 0xb6428800] non-strictly-monotonic PTS
[mp4 @ 0xb643d600] Non-monotonous DTS in output stream 0:0; previous: 33792, current: 33792; changing to 33793. This may result in incorrect timestamps in the output file.
...

Any ideas what could cause this ? I'm not familiar with DTS/PTS or what «Non-monotonous DTS» may mean.

Also, what is

--
*Jean-Marie Baran*

_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

Reply via email to