Crash on DAR/SAR source change while HW transcoding

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

Crash on DAR/SAR source change while HW transcoding

Mitja Pirih
Hi,

I am transcoding a live channel from live source. Everything works as
expected until SAR/DAR changes then ffmpeg crashes out. It happens only
when I use HW transcoding. Have you seen this behavior before? Any ideas
how to solve this issue?

/usr/bin/ffmpeg -hwaccel cuvid -c:v mpeg2_cuvid -i
udp://239.213.0.6:1234 -c:a libfdk_aac -profile:a aac_he -ac 2 -b:a 64k
-ar 48000 -c:v h264_nvenc -preset llhq -profile:v high -maxrate 2500k
-bufsize 5000k -f flv rtmp://127.0.0.1/live/test

ffmpeg version N-90591-g4b736bc Copyright (c) 2000-2018 the FFmpeg
developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --prefix=/home/mp/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/mp/ffmpeg_build/include
--extra-ldflags=-L/home/mp/ffmpeg_build/lib --extra-libs=-lpthread
--bindir=/home/mp/bin --enable-cuda --enable-cuvid --enable-libnpp
--extra-cflags=-I/usr/local/cuda/include
--extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-libass
--enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-libspeex --enable-nonfree
--enable-nvenc
  libavutil      56. 12.100 / 56. 12.100
  libavcodec     58. 17.100 / 58. 17.100
  libavformat    58. 10.100 / 58. 10.100
  libavdevice    58.  2.100 / 58.  2.100
  libavfilter     7. 14.100 /  7. 14.100
  libswscale      5.  0.102 /  5.  0.102
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile
options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'


===== Log =====
Starting ffmpeg...
[mpeg2video @ 0x2a65000] Invalid frame dimensions 0x0.
    Last message repeated 15 times
Impossible to convert between the formats supported by the filter
'Parsed_null_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
[libfdk_aac @ 0x2b24340] 3 frames left in the queue on closing
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://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: Crash on DAR/SAR source change while HW transcoding

Brainiarc7
In production, drop this: -hwaccel cuvid -c:v mpeg2_cuvid

There's a reason mpv devs do not recommend cuvid, in particular.
https://github.com/mpv-player/mpv/commit/dbef5b737e2f994f02923c8214cba368b663a655


On 5 June 2018 at 11:55, Mitja Pirih <[hidden email]> wrote:

> Hi,
>
> I am transcoding a live channel from live source. Everything works as
> expected until SAR/DAR changes then ffmpeg crashes out. It happens only
> when I use HW transcoding. Have you seen this behavior before? Any ideas
> how to solve this issue?
>
> /usr/bin/ffmpeg -hwaccel cuvid -c:v mpeg2_cuvid -i
> udp://239.213.0.6:1234 -c:a libfdk_aac -profile:a aac_he -ac 2 -b:a 64k
> -ar 48000 -c:v h264_nvenc -preset llhq -profile:v high -maxrate 2500k
> -bufsize 5000k -f flv rtmp://127.0.0.1/live/test
>
> ffmpeg version N-90591-g4b736bc Copyright (c) 2000-2018 the FFmpeg
> developers
>   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
>   configuration: --prefix=/home/mp/ffmpeg_build
> --pkg-config-flags=--static
> --extra-cflags=-I/home/mp/ffmpeg_build/include
> --extra-ldflags=-L/home/mp/ffmpeg_build/lib --extra-libs=-lpthread
> --bindir=/home/mp/bin --enable-cuda --enable-cuvid --enable-libnpp
> --extra-cflags=-I/usr/local/cuda/include
> --extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-libass
> --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
> --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx
> --enable-libx264 --enable-libx265 --enable-libspeex --enable-nonfree
> --enable-nvenc
>   libavutil      56. 12.100 / 56. 12.100
>   libavcodec     58. 17.100 / 58. 17.100
>   libavformat    58. 10.100 / 58. 10.100
>   libavdevice    58.  2.100 / 58.  2.100
>   libavfilter     7. 14.100 /  7. 14.100
>   libswscale      5.  0.102 /  5.  0.102
>   libswresample   3.  0.101 /  3.  0.101
>   libpostproc    55.  0.100 / 55.  0.100
> Hyper fast Audio and Video encoder
> usage: ffmpeg [options] [[infile options] -i infile]... {[outfile
> options] outfile}...
>
> Use -h to get full help or, even better, run 'man ffmpeg'
>
>
> ===== Log =====
> Starting ffmpeg...
> [mpeg2video @ 0x2a65000] Invalid frame dimensions 0x0.
>     Last message repeated 15 times
> Impossible to convert between the formats supported by the filter
> 'Parsed_null_0' and the filter 'auto_scaler_0'
> Error reinitializing filters!
> Failed to inject frame into filter network: Function not implemented
> Error while processing the decoded data for stream #0:0
> [libfdk_aac @ 0x2b24340] 3 frames left in the queue on closing
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://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: Crash on DAR/SAR source change while HW transcoding

Carl Eugen Hoyos-2
In reply to this post by Mitja Pirih
2018-06-05 10:55 GMT+02:00, Mitja Pirih <[hidden email]>:

> I am transcoding a live channel from live source. Everything
> works as expected until SAR/DAR changes then ffmpeg
> crashes out.

If you experience a crash with FFmpeg, please provide
backtrace, disassembly and register dump.

Thank you, Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://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: Crash on DAR/SAR source change while HW transcoding

Phil Rhodes-3
> If you experience a crash with FFmpeg, please provide> backtrace, disassembly and register dump.
Carl Eugen, If you're going to demand this information, you need to be prepared to do a lot of work helping people to get it. The ability to do these things is not common among computer users.
If you are not willing to do that, people can very reasonably assume that you are deliberately putting up barriers to bug reports. This would be very odd behaviour, as most software engineers are very keen to know where the problems in their software are, but that's your prerogative.
Normally, the software engineer would request details of the situation which caused the crash and try to recreate it so that it can be investigated. That's a completely normal part of the job of a software engineer.
If you don't want to be involved in that work, it's probably a good idea to avoid software engineering, because that's what the job involves.
-P
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://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: Crash on DAR/SAR source change while HW transcoding

Mitja Pirih
In reply to this post by Carl Eugen Hoyos-2
On 05. 06. 2018 16:15, Carl Eugen Hoyos wrote:
> 2018-06-05 10:55 GMT+02:00, Mitja Pirih <[hidden email]>:
>
>> I am transcoding a live channel from live source. Everything
>> works as expected until SAR/DAR changes then ffmpeg
>> crashes out.
> If you experience a crash with FFmpeg, please provide
> backtrace, disassembly and register dump.

Carl Eugene, sorry I should have expressed myself better. ffmpeg
stopped, there was no kernel crash.

It should be reproducible, because it happens on a couple of channels
when there is a change from [SAR 64:45 DAR 16:9] to [SAR 16:15 DAR 4:3]
and back. I tested without HW acceleration (decoding + encoding) and it
worked without stopping on a change. I presume the problem will gone
away when I drop HW decoding like Dennis suggested. I will report back.
Thou I am still interested in a solution as dropping HW decoding will
induce a high penalty on CPU.

Thanks.


Mitja
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://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: Crash on DAR/SAR source change while HW transcoding

Carl Eugen Hoyos-2
In reply to this post by Phil Rhodes-3
2018-06-05 17:23 GMT+02:00, Phil Rhodes
<[hidden email]>:

> If you don't want to be involved in that work, it's probably a good idea to
> avoid software engineering, because that's what the job involves.

Yes, I wait for over a decade that you stop trolling on our server's mailing
lists but my hopes were fruitless.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://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: Crash on DAR/SAR source change while HW transcoding

Carl Eugen Hoyos-2
In reply to this post by Mitja Pirih
2018-06-05 18:29 GMT+02:00, Mitja Pirih <[hidden email]>:

> On 05. 06. 2018 16:15, Carl Eugen Hoyos wrote:
>> 2018-06-05 10:55 GMT+02:00, Mitja Pirih <[hidden email]>:
>>
>>> I am transcoding a live channel from live source. Everything
>>> works as expected until SAR/DAR changes then ffmpeg
>>> crashes out.
>>
>> If you experience a crash with FFmpeg, please provide
>> backtrace, disassembly and register dump.
>
> Carl Eugene, sorry I should have expressed myself better.
> ffmpeg stopped, there was no kernel crash.

Thank you for the confirmation.

It is possible that the hardware encoders (as opposed to
FFmpeg's implementation) do not support aspect change.
You could partly test by using only hardware decoding
and software encoding and by using software decoding
and hardware encoding.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://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: Crash on DAR/SAR source change while HW transcoding

Brainiarc7
And with CUVID, in particular: It's decoders are very fragile.

You did mention that disabling hwaccel (cuvid?) raised your processor load
significantly, correct?

Can you confirm whether you're applying any filters down the encoder
pipeline?
Also, what processor are you using?

On 6 June 2018 at 16:14, Carl Eugen Hoyos <[hidden email]> wrote:

> 2018-06-05 18:29 GMT+02:00, Mitja Pirih <[hidden email]>:
> > On 05. 06. 2018 16:15, Carl Eugen Hoyos wrote:
> >> 2018-06-05 10:55 GMT+02:00, Mitja Pirih <[hidden email]>:
> >>
> >>> I am transcoding a live channel from live source. Everything
> >>> works as expected until SAR/DAR changes then ffmpeg
> >>> crashes out.
> >>
> >> If you experience a crash with FFmpeg, please provide
> >> backtrace, disassembly and register dump.
> >
> > Carl Eugene, sorry I should have expressed myself better.
> > ffmpeg stopped, there was no kernel crash.
>
> Thank you for the confirmation.
>
> It is possible that the hardware encoders (as opposed to
> FFmpeg's implementation) do not support aspect change.
> You could partly test by using only hardware decoding
> and software encoding and by using software decoding
> and hardware encoding.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://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: Crash on DAR/SAR source change while HW transcoding

Mitja Pirih
In reply to this post by Carl Eugen Hoyos-2
On 06. 06. 2018 15:14, Carl Eugen Hoyos wrote:

> 2018-06-05 18:29 GMT+02:00, Mitja Pirih <[hidden email]>:
>> On 05. 06. 2018 16:15, Carl Eugen Hoyos wrote:
>>> 2018-06-05 10:55 GMT+02:00, Mitja Pirih <[hidden email]>:
>>>
>>>> I am transcoding a live channel from live source. Everything
>>>> works as expected until SAR/DAR changes then ffmpeg
>>>> crashes out.
>>> If you experience a crash with FFmpeg, please provide
>>> backtrace, disassembly and register dump.
>> Carl Eugene, sorry I should have expressed myself better.
>> ffmpeg stopped, there was no kernel crash.
> Thank you for the confirmation.
>
> It is possible that the hardware encoders (as opposed to
> FFmpeg's implementation) do not support aspect change.
> You could partly test by using only hardware decoding
> and software encoding and by using software decoding
> and hardware encoding.

You are probably right it is probably so.
As Dennis suggested I dropped HW decoding and use only software
decoding. For past 24 hours ffmpeg instance is still encoding (HW)
without drops.

Br,
M.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://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: Crash on DAR/SAR source change while HW transcoding

Mitja Pirih
In reply to this post by Brainiarc7
On 06. 06. 2018 17:25, Dennis Mungai wrote:
> And with CUVID, in particular: It's decoders are very fragile.
>
> You did mention that disabling hwaccel (cuvid?) raised your processor load
> significantly, correct?
>
> Can you confirm whether you're applying any filters down the encoder
> pipeline?
> Also, what processor are you using?

Yes, the load was raised by 100%, not that is really huge (from 6% - 9%
to 12% - 15%). But on 29 running ffmpeg instances it matters. Thou I am
still trying to understand where the bottleneck is when I try to pass
more than 32+ instances, but that is a matter for a new subject.

Dependent on a stream I am "burning" subtitles into a video and mapping
out only those streams that I am interested in, so one audio + one video
(optionally burned subtitles). Everything else (deinterlace) is done in
decoding stage.

CPU:
[    0.074709] smpboot: CPU0: Intel(R) Core(TM) i7-4770S CPU @ 3.10GHz
(family: 0x6, model: 0x3c, stepping: 0x3)


Br,
Mitja
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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