OK I did some tests. Source file was the short clip of NOVA that I reported earlier on. Recall that Channels ffmpeg
could only transcode it at 0.9–0.95x, right on the bleeding edge of stuttering. And that it maxed out the CPUs to do so, up to 380%.
With just the default software codecs, my new ffmpeg
does better than this:
$ ffmpeg -i NOVA\ S46E01\ 2019-01-02\ Pluto\ and\ Beyond\ 2019-08-14-2017.mpg nova_out.mp4
ffmpeg version N-94563-g3aeb681f07 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --arch=armhf --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree --enable-decoder=mpeg2_mmal --enable-mmal --enable-decoder=h264_mmal
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 30.100 / 58. 30.100
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mpeg2video @ 0x2f96a90] Invalid frame dimensions 0x0.
Last message repeated 28 times
[mpegts @ 0x2f92320] PES packet size mismatch
Input #0, mpegts, from 'NOVA S46E01 2019-01-02 Pluto and Beyond 2019-08-14-2017.mpg':
Duration: 00:11:40.33, start: 31840.284300, bitrate: 11978 kb/s
Program 7
Stream #0:0[0x71]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x74](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> mpeg4 (native))
Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'nova_out.mp4':
Metadata:
encoder : Lavf58.30.100
Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
Metadata:
encoder : Lavc58.55.100 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: 18446744073709551615
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.55.100 aac
frame= 4701 fps= 38 q=31.0 size= 28928kB time=00:02:36.82 bitrate=1511.1kbits/s dup=38 drop=0 speed=1.26x
Strangely, cpu load for this software only encode was only 250% or so, far less than the 380% the Channel's ffmpeg
pegs at. Is your version doing something extra that could account for this?
Then I tried with mmal
and got the expected failure:
mpegts @ 0x2ea2350] Failed to open codec in avformat_find_stream_info
...
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (mpeg2_mmal) -> mpeg4 (native))
Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Error while opening decoder for input stream #0:0 : Unknown error occurred
Then I tried with the omx
hardware encoder:
$ ffmpeg -i NOVA\ S46E01\ 2019-01-02\ Pluto\ and\ Beyond\ 2019-08-14-2017.mpg -codec:v h264_omx nova_out.mp4
ffmpeg version N-94563-g3aeb681f07 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --arch=armhf --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree --enable-decoder=mpeg2_mmal --enable-mmal --enable-decoder=h264_mmal
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 30.100 / 58. 30.100
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mpeg2video @ 0x2cd5aa0] Invalid frame dimensions 0x0.
Last message repeated 28 times
[mpegts @ 0x2cd1330] PES packet size mismatch
Input #0, mpegts, from 'NOVA S46E01 2019-01-02 Pluto and Beyond 2019-08-14-2017.mpg':
Duration: 00:11:40.33, start: 31840.284300, bitrate: 11978 kb/s
Program 7
Stream #0:0[0x71]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x74](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s
File 'nova_out.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (h264_omx))
Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_omx @ 0x2d22da0] Using OMX.broadcom.video_encode
Output #0, mp4, to 'nova_out.mp4':
Metadata:
encoder : Lavf58.30.100
Stream #0:0: Video: h264 (h264_omx) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
Metadata:
encoder : Lavc58.55.100 h264_omx
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.55.100 aac
frame= 628 fps= 38 q=-0.0 size= 768kB time=00:00:20.88 bitrate= 301.2kbits/s dup=38 drop=0 speed=1.28x
So... pretty much the same speed . Meanwhile, however, the CPU load dropped from 250% to 160%, so OMX is doing something anyway. So both of these seem to outperform the Channels-provided ffmpeg
, and the hardware version leaves quite a bit more CPU overhead for other tasks (like recording other streams), so would probably be more stable.
Haven't yet substituted for Channels' ffmpeg
, probably need to do some severe input option editing given the switch from libx264
, yes?