[FFmpeg-user] Let ffmpeg pick correct fps from stdin
Jean-Marie Baran
jean-marie.baran at ama.bzh
Tue Jan 19 09:40:08 CET 2016
On 15/01/2016 16:33, Jean-Marie Baran wrote:
>
>
> 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
>
>
Well, I somewhat solved the problem by removing the "-re" option which
was preceding "-use_wallclock_as_timestamps". The fps is now guessed
correctly, and the DTS/PTS things seem to be right. The video plays at
correct speed when read by ffplay or VLC or whatever, even if I still
get some warning messages «Past duration 0.xxx too large». If anyone
gets an idea about this, I'll gladly hear it.
Here is the trace:
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
Input #0, s16le, from 'tcp://localhost:44722?listen=1':
Duration: N/A, bitrate: 705 kb/s
Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
D/AMA.sr.AbusService( 2082): Calling recording_started()
D/amaCnxMgr.pyc( 367): AMA.amaAbusService - recording_started() return
code: 0
E/amaCnxMgr.pyc( 367): AMA.amaAbusService - Cannot notify the UI that
the record started: callback not defined
[mjpeg @ 0xb6427c00] Changeing bps to 8
Input #1, mjpeg, from 'pipe:':
Duration: N/A, start: 1453192324.981191, 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
[swscaler @ 0xb6517000] deprecated pixel format used, make sure you did
set range correctly
[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),
yuv420p, 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))
Past duration 0.974800 too large
Past duration 0.746681 too large
Past duration 0.765221 too large
Past duration 0.888924 too large
Past duration 0.992058 too large
Past duration 0.631645 too large
Past duration 0.957054 too large
Past duration 0.698036 too large
--
*Jean-Marie Baran*
AMA developer
Skype: jeanmarie.baran
Email: jean-marie.baran at ama.bzh <mailto:jean-marie.baran at ama.bzh>
www.advancedmedicalapplications.com
<http://www.advancedmedicalapplications.com>
AMA Logo
More information about the ffmpeg-user
mailing list