Unsync between Audio and Video and other Issues

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Unsync between Audio and Video and other Issues

Rudolf Schmidt
Hi,

I try to find a way to record my screen with income (mic) and outcome
audio to record video calls with people

I use the script:

FILE="screencast$(date +%Y%m%d%H%M%S)"
FFREPORT=file=/home/rs/screencasts/$FILE.log:level=32 \
ffmpeg \
    -f pulse -ac 2 -ar 48000 -i
alsa_output.pci-0000_0d_00.3.analog-stereo.monitor \
    -f pulse -ac 2 -ar 48000 -i alsa_input.pci-0000_0d_00.3.analog-stereo \
    -filter_complex amix=inputs=2 \
    -thread_queue_size 65536 -f x11grab -s $(xdpyinfo|grep
dimensions|awk '{print $2}') -framerate 30 -r 30 -i :0.0 \
    -vcodec libx264 -preset veryfast -crf 18 -pix_fmt yuv420p \
    -acodec libmp3lame -ac 2 -ar 48000 \
    ~/screencasts/$FILE.mp4


Beside some weird warnings my major problem is that my audio sometimes
become corrupt. After 1-2 minutes its start to be faster, but not
always, depending on the length of the video file, but even it does not
get shorter or kind of "compressed" it gets unsynced with the video.
Sometimes even the video itself or the record of the screen becomes
faster and it also lead to unsync with the audio. I do not know what is
going on, its more than weird, tried to figure it out with people from
#ffmpeg at freenode but not able to get to the bottom of the ground,
assumed it could be a problem with pulseaudio.

--
Best Regards,
Mit freundlichen Grüßen,
Rudolf Schmidt


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

screencast20190921062700.log (40K) Download Attachment
signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unsync between Audio and Video and other Issues

Carl Eugen Hoyos-2
Am Sa., 21. Sept. 2019 um 06:33 Uhr schrieb Rudolf Schmidt
<[hidden email]>:

> frame= 1507 fps= 21 q=24.0 size=   16896kB time=00:00:48.86 bitrate=2832.4kbits/s speed=0.69x

Your system is too slow.
Try ultrafast, a lower resolution, lower framerate or hardware encoding.

Note that only current FFmpeg git head is supported here.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Unsync between Audio and Video and other Issues

Rudolf Schmidt
This is a qualified response, but I cannot understand why my system
should be too weak.

I have a AMD Ryzen 7 1700X (16) @ 3.400GHz with 8 Cores and 16 Threads.
How this can be too slow and 64 GB RAM.

Is my configuration wrong? I cannot use a lower resolution because it
captures just a part of the screen. If you render it down to a lower
resolution and still capture the entire screen it would be fine but I do
not know how to do that.


Where do you see that my system is slow, in the speed because its lower
than 1?

Best Regards,
Mit freundlichen Grüßen,
Rudolf Schmidt

On 9/21/19 12:42 PM, Carl Eugen Hoyos wrote:

> Am Sa., 21. Sept. 2019 um 06:33 Uhr schrieb Rudolf Schmidt
> <[hidden email]>:
>
>> frame= 1507 fps= 21 q=24.0 size=   16896kB time=00:00:48.86 bitrate=2832.4kbits/s speed=0.69x
> Your system is too slow.
> Try ultrafast, a lower resolution, lower framerate or hardware encoding.
>
> Note that only current FFmpeg git head is supported here.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unsync between Audio and Video and other Issues

Paul B Mahol
On 9/21/19, Rudolf Schmidt <[hidden email]> wrote:

> This is a qualified response, but I cannot understand why my system
> should be too weak.
>
> I have a AMD Ryzen 7 1700X (16) @ 3.400GHz with 8 Cores and 16 Threads.
> How this can be too slow and 64 GB RAM.
>
> Is my configuration wrong? I cannot use a lower resolution because it
> captures just a part of the screen. If you render it down to a lower
> resolution and still capture the entire screen it would be fine but I do
> not know how to do that.
>
>
> Where do you see that my system is slow, in the speed because its lower
> than 1?

For realtime encoding it should be around 1.

How is CPU usage during encoding?

>
> Best Regards,
> Mit freundlichen Grüßen,
> Rudolf Schmidt
>
> On 9/21/19 12:42 PM, Carl Eugen Hoyos wrote:
>> Am Sa., 21. Sept. 2019 um 06:33 Uhr schrieb Rudolf Schmidt
>> <[hidden email]>:
>>
>>> frame= 1507 fps= 21 q=24.0 size=   16896kB time=00:00:48.86
>>> bitrate=2832.4kbits/s speed=0.69x
>> Your system is too slow.
>> Try ultrafast, a lower resolution, lower framerate or hardware encoding.
>>
>> Note that only current FFmpeg git head is supported here.
>>
>> Carl Eugen
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
>
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Unsync between Audio and Video and other Issues

Rudolf Schmidt
around 30% never more than 40%. so everything smooth. even my fans do
not become crazy. So I really wonder why its slow. I use the nvidia
driver because of hardware acceleration.


Best Regards,
Mit freundlichen Grüßen,
Rudolf Schmidt

On 9/21/19 7:49 PM, Paul B Mahol wrote:

> On 9/21/19, Rudolf Schmidt <[hidden email]> wrote:
>> This is a qualified response, but I cannot understand why my system
>> should be too weak.
>>
>> I have a AMD Ryzen 7 1700X (16) @ 3.400GHz with 8 Cores and 16 Threads.
>> How this can be too slow and 64 GB RAM.
>>
>> Is my configuration wrong? I cannot use a lower resolution because it
>> captures just a part of the screen. If you render it down to a lower
>> resolution and still capture the entire screen it would be fine but I do
>> not know how to do that.
>>
>>
>> Where do you see that my system is slow, in the speed because its lower
>> than 1?
> For realtime encoding it should be around 1.
>
> How is CPU usage during encoding?
>
>> Best Regards,
>> Mit freundlichen Grüßen,
>> Rudolf Schmidt
>>
>> On 9/21/19 12:42 PM, Carl Eugen Hoyos wrote:
>>> Am Sa., 21. Sept. 2019 um 06:33 Uhr schrieb Rudolf Schmidt
>>> <[hidden email]>:
>>>
>>>> frame= 1507 fps= 21 q=24.0 size=   16896kB time=00:00:48.86
>>>> bitrate=2832.4kbits/s speed=0.69x
>>> Your system is too slow.
>>> Try ultrafast, a lower resolution, lower framerate or hardware encoding.
>>>
>>> Note that only current FFmpeg git head is supported here.
>>>
>>> Carl Eugen
>>> _______________________________________________
>>> ffmpeg-user mailing list
>>> [hidden email]
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>
>>> To unsubscribe, visit link above, or email
>>> [hidden email] with subject "unsubscribe".
>>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unsync between Audio and Video and other Issues

Rudolf Schmidt
Hi

I have spoken with some guys from the IRC #ffmpeg who encouraged me to
not use ffmpeg because its poor developed. I was surprised. Its sad to
hear coz ffmpeg is at command line, flexible and interesting, never
expected its "poor in design".

So hope you guys will redesign it by time and make it multi thread
supported, its amazing that in todays time with 16 threads and more
ffmpeg still works single threaded.


Best Regards,
Mit freundlichen Grüßen,
Rudolf Schmidt

On 9/21/19 8:00 PM, Rudolf Schmidt wrote:

> around 30% never more than 40%. so everything smooth. even my fans do
> not become crazy. So I really wonder why its slow. I use the nvidia
> driver because of hardware acceleration.
>
>
> Best Regards,
> Mit freundlichen Grüßen,
> Rudolf Schmidt
>
> On 9/21/19 7:49 PM, Paul B Mahol wrote:
>> On 9/21/19, Rudolf Schmidt <[hidden email]> wrote:
>>> This is a qualified response, but I cannot understand why my system
>>> should be too weak.
>>>
>>> I have a AMD Ryzen 7 1700X (16) @ 3.400GHz with 8 Cores and 16 Threads.
>>> How this can be too slow and 64 GB RAM.
>>>
>>> Is my configuration wrong? I cannot use a lower resolution because it
>>> captures just a part of the screen. If you render it down to a lower
>>> resolution and still capture the entire screen it would be fine but I do
>>> not know how to do that.
>>>
>>>
>>> Where do you see that my system is slow, in the speed because its lower
>>> than 1?
>> For realtime encoding it should be around 1.
>>
>> How is CPU usage during encoding?
>>
>>> Best Regards,
>>> Mit freundlichen Grüßen,
>>> Rudolf Schmidt
>>>
>>> On 9/21/19 12:42 PM, Carl Eugen Hoyos wrote:
>>>> Am Sa., 21. Sept. 2019 um 06:33 Uhr schrieb Rudolf Schmidt
>>>> <[hidden email]>:
>>>>
>>>>> frame= 1507 fps= 21 q=24.0 size=   16896kB time=00:00:48.86
>>>>> bitrate=2832.4kbits/s speed=0.69x
>>>> Your system is too slow.
>>>> Try ultrafast, a lower resolution, lower framerate or hardware encoding.
>>>>
>>>> Note that only current FFmpeg git head is supported here.
>>>>
>>>> Carl Eugen
>>>> _______________________________________________
>>>> ffmpeg-user mailing list
>>>> [hidden email]
>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>
>>>> To unsubscribe, visit link above, or email
>>>> [hidden email] with subject "unsubscribe".
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unsync between Audio and Video and other Issues

Carl Eugen Hoyos-2
Am So., 22. Sept. 2019 um 17:02 Uhr schrieb Rudolf Schmidt
<[hidden email]>:

> I have spoken with some guys from the IRC #ffmpeg who encouraged me to
> not use ffmpeg because its poor developed. I was surprised. Its sad to
> hear coz ffmpeg is at command line, flexible and interesting, never
> expected its "poor in design".
>
> So hope you guys will redesign it by time and make it multi thread
> supported, its amazing that in todays time with 16 threads and more
> ffmpeg still works single threaded.

With all due respect, I believe you should troll somewhere else.

If you don't leave, please remember that top-posting is not welcome
here, Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Unsync between Audio and Video and other Issues

JackDesBwa
I am pretty sure being (actively or passively) aggressive will solve
nothing for nobody in this discussion (on both sides).
I am not a long-term user and still learn how to use ffmpeg, however I can
add a few information to help to solve the problem.

Your system cannot handle the throughput of your data as already stated.
Bear in mind that you have {3440(width)×1440(height)×24(bits ber
pixel)×30(fps) = 3.5Gbps and also 2(inputs)×2(channels)×48000(sample
rate)×16(bits per sample) = 3Mbps} of data to analyze in order to
understand the structure so that it can be compressed. You have a powerful
hardware, but video compression is a tremendously hard work that require a
lot of computation especially at those definitions.

As I can see, you are using the libx264 encoder which does not use hardware
acceleration.
I am surprised that your CPU is not fully loaded as this encoder does have
multi-thread support.
However, by itself it is not a magical word. Some problem do not
parallelize well, which mean that when you add cores it will not improve
that easy (and then additional cores might be without work). It is possible
that video compression (especially live one) do not scale well, because for
the little I know, it needs to know about the neighboring frames which is
often a barrier for parallel programming (another tremendously hard
discipline)

As it was already suggested, you can try to use an hardware accelerated
encoder in case it can help (https://trac.ffmpeg.org/wiki/HWAccelIntro). It
is not easy to make work at first, but it can have impressive acceleration
(although with your powerful CPU it might not be very extremely
impressive). Your CPU compresses slightly under realtime, maybe even a
small acceleration would suffice.
To use your nvidia board, perhaps you can start by trying to replace
"-vcodec libx264" by "-vcodec h264_nvenc". There might be some other
options to tweak after that.

You can also downscale as soon as possible (also proposed and you said it
would be possible) with a "scale=2580x1080" (
https://ffmpeg.org/ffmpeg-filters.html#scale-1) in your filter_complex for
example (see documentation & examples to see how to add it in the command
in addition to your amix filter. I would say that adding a second
-filter_complex argument would work, but not totally sure). This would
remove more than 40% volume of data to analyze and hopefully stay in your
target.

There might be other things to test, but these two are already good ways to
explore.
Also, you might try to use a software that is specialized in the recording
of the screen which can be likely optimized toward this specific task.

JackDesBwa
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Unsync between Audio and Video and other Issues

Carl Zwanzig
In reply to this post by Rudolf Schmidt
On 9/22/2019 8:02 AM, Rudolf Schmidt wrote:
> So hope you guys will redesign it by time and make it multi thread
> supported, its amazing that in todays time with 16 threads and more
> ffmpeg still works single threaded.

Given that AFAIK most of the people working on ffmpeg are not paid to do so,
it's amazing that in todays time people are still telling volunteers what
their priorities should be.

This is along the lines of complaining that a BMW F850GS needs additional
wheels for stability (the F850GS is a motorcycle).

If you're not satisfied with what ffmpeg will do, and I frequently have
problems with that myself, consider getting involved with the community to
develop those features. Or do without.

Later,

z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".