Re: [FFmpeg-user] audio / video out of sync after recording rtmp stream

2019-04-13 Thread Frans Gouverne
okay, thanks, will try it out.

By the way, I also find this workaround myself: stripping off the first 4
seconds (corresponds to the keyframe interval) from the flv file using: -ss
00:00:04.000
As a result, the excessive audio frames are gone, have tested this with the
problematic record and it works as expected: audio and video are perfectly
in sync now!

Frans





Op za 13 apr. 2019 om 13:57 schreef Carl Eugen Hoyos :

> 2019-04-13 11:33 GMT+02:00, Frans Gouverne :
>
> > ffmpeg -y -i "rtmp:/domein/client/name live=1" -vcodec copy
> > -acodec copy -f ouput.flv
>
> Instead please use something like (untested):
> $ ffmpeg -f data -i rtmp://... -c copy -f data -map 0 out.flv
> if you cannot use mplayer -dumpstream or something equivalent.
>
> Carl Eugen
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-user] audio / video out of sync after recording rtmp stream

2019-04-13 Thread Frans Gouverne
Hi,

Have some troubles with syncing audio with video after record a live RTMP
stream:

ffmpeg -y -i "rtmp:/domein/client/name live=1" -vcodec copy -acodec copy -f
ouput.flv

When looking at the first frames of ouput.flv using ffprobe, it starts with
about 30 audio frames. Then, after e.g. half a second, the first video
frame do show up. This is expected because I suppose ffmpeg has to wait for
the first key frame of the video.

So the record has approx. 30 audio frames for about half a second, after
this the video and audio frames do show up repeatedly.

Now when I convert the flv file to mp4 and run the mp4 file in a player,
players like Windows Media Player do play the video half a second later
compared to the audio, so audio is completely out of sync. (VLC player does
play it right by the way).

I could correct it with a video editor (shifting the audio track with half
a second), then it plays correctly in both Windows Media Player as well as
VLC player. But of course I would like to have a correct version right away.

*Questions*:
Is there any way I can tell ffmpeg to start recording the audio channel
only after the first video keyframe is received?

Or can ffmpeg add time stamps explicitly (starting with 00:00:00.000) to
both audio and video frames channels when starting recording the RTMP
stream?

Or, after the fact, is there a way to remove the first set of audio frames
(from the flv or mp4 file) before the first video frame shows up without
converting the complete file again?

Have attached the log file of ffprobe, the first video frame shows up at
line 457.

Any hints are much appreciated,
best regards,
Frans (Netherlands)


logflv.log
Description: Binary data
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Invalid duration specification for force_key_frames

2015-09-04 Thread Frans Gouverne
thanks, recompiling latest version of x264 and ffmpeg solved the problem!

Not sure what happened a few months ago, must have installed an old version
indeed.

Thanks for your help,

best regards, Frans



2015-09-03 15:39 GMT+02:00 Moritz Barsnick <barsn...@gmx.net>:

> On Thu, Sep 03, 2015 at 15:03:34 +0200, Frans Gouverne wrote:
> > *Hereby my output:*
> > ffmpeg version N-36084-g993c84e-xuggle-5.5 Copyright (c) 2000-2012 the
> > FFmpeg developers
> >   built on Jun 11 2015 13:08:14 with gcc 4.4.7 20120313 (Red Hat
> 4.4.7-11)
>
> I always have my problems decoding this N-36084-g993c84e stuff (why
> can't any of the git web interfaces search for g993c84e?), but from the
> copyright string, I think you are using an extremely old version of
> ffmpeg. Are you sure you are reading the documentation corresponding to
> that version, and not from the web? Web refers to latest.
>
> Anyway, please build from the latest git source or grab an ffmpeg
> binary built from very recent code. I assure you that it supports the
> "expr:" syntax.
>
> Moritz
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>



-- 
Gouverne Web Design
Colenso 125
3761GL Soest
Tel: 035-6015569
Mobiel: 06-11408032
KvK: 32108255
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


[FFmpeg-user] Invalid duration specification for force_key_frames

2015-09-03 Thread Frans Gouverne
Hello,

since I recompiled ffmpeg some months ago, I cannot use expressions on the
command line anymore, they are simply not recognized. For example:

ffmpeg -re -i demo.mp4 -ac 2 -b:a 64k -ar 44100 -c:v libx264 -r
exp:gt(25,30) -f mp4 output.mp4

Invalid framerate value: exp:gt(25,30)

Below the complete output.

Do I need a specific configuration option when compiling ffmpeg to enable
expressions?

Regards Frans

==

ffmpeg version N-49044-g89afa63 Copyright (c) 2000-2013 the FFmpeg
developers
  built on Jan 19 2013 20:36:06 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfi
g --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena
ble-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-libtwolame --enable-libvo-aacenc --en
able-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
--enable-filter=frei0r
  libavutil  52. 15.100 / 52. 15.100
  libavcodec 54. 89.100 / 54. 89.100
  libavformat54. 61.101 / 54. 61.101
  libavdevice54.  3.102 / 54.  3.102
  libavfilter 3. 32.101 /  3. 32.101
  libswscale  2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'demo.mp4':
  Metadata:
major_brand : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.61.101
  Duration: 00:29:36.00, start: 0.00, bitrate: 654 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 480x204 [SAR 1:1 DAR 40:17], 537
kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc
Metadata:
  handler_name: VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
fltp, 111 kb/s
Metadata:
  handler_name: SoundHandler
Invalid framerate value: exp:gt(25,30)
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


Re: [FFmpeg-user] Invalid duration specification for force_key_frames

2015-09-03 Thread Frans Gouverne
Hi Moritz,

thanks for the reply.

Using -r for the frame rate is just a simple example to check if expr: is
working or not. By the way, it should be expr:, not exp: but that does not
change anything for my example or output.

When using max(), I still get:
Invalid framerate value: expr:max(25,30)

ffmpeg simply doesn't recognize any expr: on the command line!!

I got the same problem with version 2.6.3 from June 2015:
ffmpeg version N-36084-g993c84e-xuggle-5.5
built on Jun 11 2015 13:08:14 with gcc 4.4.7 20120313 (Red Hat 4.4.7-11)

The version that worked before was 1.2.1.

But maybe it has something to do with my compilation of ffmpeg? This is
what I used as config options:

./configure --enable-librtmp --enable-libx264 --enable-gpl




2015-09-03 10:54 GMT+02:00 Moritz Barsnick <barsn...@gmx.net>:

> Hi Frans,
>
> On Thu, Sep 03, 2015 at 10:36:32 +0200, Frans Gouverne wrote:
> > since I recompiled ffmpeg some months ago, I cannot use expressions on
> the
> > command line anymore, they are simply not recognized. For example:
> >
> > ffmpeg -re -i demo.mp4 -ac 2 -b:a 64k -ar 44100 -c:v libx264 -r
> > exp:gt(25,30) -f mp4 output.mp4
> >
> > Invalid framerate value: exp:gt(25,30)
>
> a) I can successfully use expressions for "-r" if I omit the "exp:"
>part. (That may have changed over the months, I don't know.)
>
> b) gt(25,30) won't work with "-r", as "-r" doesn't accept "0"!
>From the docs:
>‘gt(x, y)’
>Return 1 if x is greater than y, 0 otherwise.
>Are you looking for "max(25,30)"?
>
> >   built on Jan 19 2013 20:36:06 with gcc 4.7.2 (GCC)
>
> Did you say "some months ago"?? 32 months! How old was the ffmpeg you
> were using before?
>
> Moritz
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>



-- 
Gouverne Web Design
Colenso 125
3761GL Soest
Tel: 035-6015569
Mobiel: 06-11408032
KvK: 32108255
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


Re: [FFmpeg-user] Invalid duration specification for force_key_frames

2015-09-03 Thread Frans Gouverne
I think I mixed up a few things. It looks like expr: is only valid for
option force_key_frames. That is the original option I had troubles with.
Just to make a simple example, I have used it for the frame rate as well.
But now I do understand that "expr:" must not be used for the frame rate.
If I simply specify max(25,30) it is working!

But still my option force_key_frames is not working. From the ffmpeg manual
I use:

-force_key_frames expr:gte(t,n_forced*5)


It gives me the following error:

  Invalid duration specification for force_key_frames:
expr:gte(t,n_forced*5)

On Linux I use quotes around expr:gte(t,n_forced*5) or put backslashes in
front of the round brackets otherwise bash starts to complain.

So, it seems to be related to option force_key_frames only.

2015-09-03 12:46 GMT+02:00 Frans Gouverne <frans...@gmail.com>:

> Hi Moritz,
>
> thanks for the reply.
>
> Using -r for the frame rate is just a simple example to check if expr: is
> working or not. By the way, it should be expr:, not exp: but that does not
> change anything for my example or output.
>
> When using max(), I still get:
> Invalid framerate value: expr:max(25,30)
>
> ffmpeg simply doesn't recognize any expr: on the command line!!
>
> I got the same problem with version 2.6.3 from June 2015:
> ffmpeg version N-36084-g993c84e-xuggle-5.5
> built on Jun 11 2015 13:08:14 with gcc 4.4.7 20120313 (Red Hat 4.4.7-11)
>
> The version that worked before was 1.2.1.
>
> But maybe it has something to do with my compilation of ffmpeg? This is
> what I used as config options:
>
> ./configure --enable-librtmp --enable-libx264 --enable-gpl
>
>
>
>
> 2015-09-03 10:54 GMT+02:00 Moritz Barsnick <barsn...@gmx.net>:
>
>> Hi Frans,
>>
>> On Thu, Sep 03, 2015 at 10:36:32 +0200, Frans Gouverne wrote:
>> > since I recompiled ffmpeg some months ago, I cannot use expressions on
>> the
>> > command line anymore, they are simply not recognized. For example:
>> >
>> > ffmpeg -re -i demo.mp4 -ac 2 -b:a 64k -ar 44100 -c:v libx264 -r
>> > exp:gt(25,30) -f mp4 output.mp4
>> >
>> > Invalid framerate value: exp:gt(25,30)
>>
>> a) I can successfully use expressions for "-r" if I omit the "exp:"
>>part. (That may have changed over the months, I don't know.)
>>
>> b) gt(25,30) won't work with "-r", as "-r" doesn't accept "0"!
>>From the docs:
>>‘gt(x, y)’
>>Return 1 if x is greater than y, 0 otherwise.
>>Are you looking for "max(25,30)"?
>>
>> >   built on Jan 19 2013 20:36:06 with gcc 4.7.2 (GCC)
>>
>> Did you say "some months ago"?? 32 months! How old was the ffmpeg you
>> were using before?
>>
>> Moritz
>> ___
>> ffmpeg-user mailing list
>> ffmpeg-user@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>
>
>
> --
> Gouverne Web Design
> Colenso 125
> 3761GL Soest
> Tel: 035-6015569
> Mobiel: 06-11408032
> KvK: 32108255
>
>


-- 
Gouverne Web Design
Colenso 125
3761GL Soest
Tel: 035-6015569
Mobiel: 06-11408032
KvK: 32108255
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


Re: [FFmpeg-user] Invalid duration specification for force_key_frames

2015-09-03 Thread Frans Gouverne
If I do not use the quotes I do get:
*-bash: syntax error near unexpected token `('*

*So I tried:*
ffmpeg  -i demo.mp4 -c:v libx264 -t 100 -force_key_frames
"expr:gte(t,n_forced*5)" -f null -

*Hereby my output:*
ffmpeg version N-36084-g993c84e-xuggle-5.5 Copyright (c) 2000-2012 the
FFmpeg developers
  built on Jun 11 2015 13:08:14 with gcc 4.4.7 20120313 (Red Hat 4.4.7-11)
  configuration: --prefix=/usr/local --extra-version=xuggle-5.5
--extra-cflags=-I/tmp/xuggle-xuggler/build/native/x86_64-unknown-linux-gnu/captive/stage/usr/local/include
--extra-ldflags=-L/tmp/xuggle-xuggler/build/native/x86_64-unknown-linux-gnu/captive/stage/usr/local/lib
--disable-shared --enable-pic --enable-gpl --enable-nonfree
--enable-libx264 --enable-version3 --enable-libmp3lame --enable-libvorbis
--enable-libtheora --enable-libspeex --enable-libvo-aacenc
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp
--enable-openssl --enable-zlib --enable-libvpx
  libavutil  51. 46.100 / 51. 46.100
  libavcodec 54. 14.101 / 54. 14.101
  libavformat54.  3.100 / 54.  3.100
  libavdevice53.  4.100 / 53.  4.100
  libavfilter 2. 67.101 /  2. 67.101
  libswscale  2.  1.100 /  2.  1.100
  libswresample   0. 10.100 /  0. 10.100
  libpostproc52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'demo.mp4':
  Metadata:
major_brand : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.61.101
  Duration: 01:24:22.56, start: 0.00, bitrate: 569 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
720x406 [SAR 1:1 DAR 360:203], 398 kb/s, 50 fps, 150 tbr, 90k tbn, 180k tbc
Metadata:
  handler_name: VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
s16, 160 kb/s
Metadata:
  handler_name: SoundHandler
Invalid duration specification for force_key_frames: expr:gte(t,n_forced*5)


2015-09-03 13:57 GMT+02:00 Moritz Barsnick <barsn...@gmx.net>:

> On Thu, Sep 03, 2015 at 13:41:20 +0200, Frans Gouverne wrote:
> > I use:
> >
> > -force_key_frames expr:gte(t,n_forced*5)
> >
> > It gives me the following error:
> >
> >   Invalid duration specification for force_key_frames:
> > expr:gte(t,n_forced*5)
>
> Well, then something is wrong with your ffmpeg version. Please post a
> full command line and complete, uncut console output from a
> reproducible attempt.
>
> Your expression works fine for me on Linux with said quotes (though I'm
> not sure it makes sense):
>
> $ ffmpeg -f lavfi -i testsrc -c:v libx264 -t 100 -force_key_frames
> "expr:gte(t,n_forced*5)" -f null -
> [I'm not quoting the output here. I simply don't get an error.]
>
> Moritz
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>



-- 
Gouverne Web Design
Colenso 125
3761GL Soest
Tel: 035-6015569
Mobiel: 06-11408032
KvK: 32108255
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


Re: [FFmpeg-user] ffmpeg extremely high consumption

2015-06-18 Thread Frans Gouverne
You need to specify option -re before the input file to read input as
native frame rate. Otherwise ffmpeg will try to convert as fast as possible
(neglecting the input frame rate), using as much as CPU power as it can
get. As a result, you cannot view the output stream as well. So please use
something like:

ffmpeg -re -i video.mp4 [...]

I have a test system with much less CPU resources as your system but my CPU
power is not exceeding around 60%. But when I do not use option -re it goes
up to 175%!



2015-06-14 18:16 GMT+02:00 En Figureo Canal figureo56@gmail.com:

 On Sat, Jun 13, 2015 at 10:28 PM, Pavel Koshevoy pkoshe...@gmail.com
 wrote:

  On 6/13/15 17:49, En Figureo Canal wrote:
 
  On Sat, Jun 13, 2015 at 8:24 PM, Moritz Barsnick barsn...@gmx.net
  wrote:
 
   On Sat, Jun 13, 2015 at 19:17:51 -0400, En Figureo Canal wrote:
 
  Noticed that, after Henk's reply, if I use -vcodec copy then the
 output
  will copy the source video's attribute (-vb, size, etc...), but, if
 I
  really need to set the video rate (-vb) then I need to specify the
 codec
  needed to encode the new video.
 
  No, it does not copy the attributes (those are very had to duplicate),
  it copies the stream without reencoding. You wouldn't even need libx264
  for that.
 
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
 
   I understand I don't need libx264 but, when I tried it like this:
 
  ffmpeg -i video.mp4 -vcodec copy -vb 1024k -f flv rtmp://ip/live/test
 
  the output rate was the original video rate at 4M
 
  But, if I do this:
 
  ffmpeg -i video.mp4 -vcodec libx264 -vb 1024k  -f flv
 rtmp://ip/live/test
 
  the output rate is at 1M but video freezes.
 
 
  You either need a faster computer, or a hardware accelerated encoder
  (nvenc if you have compatible NVIDIA card), or you can use a less
 demanding
  libx264 preset -- veryfast might work, ultrafast is most likely to
  work.  I believe the default is medium.  The cheapest and quickest
 thing
  you can try is adding -preset ultrafast after libx264.  If you don't like
  the quality try -preset veryfast. If that fails consider using nvenc.
 
  Also, see here -- https://trac.ffmpeg.org/wiki/EncodingForStreamingSites
  -- it appears to be relevant to what you are trying to do.
 
  Pavel.
 
 
  ___
  ffmpeg-user mailing list
  ffmpeg-user@ffmpeg.org
  http://ffmpeg.org/mailman/listinfo/ffmpeg-user
 


 Pavel thanks for replying.

 I'm using ultrafast preset.
 ___
 ffmpeg-user mailing list
 ffmpeg-user@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-user




-- 
Gouverne Web Design
Colenso 125
3761GL Soest
Tel: 035-6015569
Mobiel: 06-11408032
KvK: 32108255
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user