rgriggs
Posts: 5
Joined: Mon Aug 27, 2018 10:15 pm

How to specify baseline profile from ffmpeg?

Tue Sep 25, 2018 2:44 pm

I need to encode a video using ffmpeg, using the h264_omx codec, and using the Baseline profile. How can I pass the baseline option to the h264_omx encoder through ffmpeg? I tried using "-profile:v baseline" option but the following error results:

Code: Select all

[h264_omx @ 0x247f440] [Eval @ 0x7ea9a2c0] Undefined constant or missing '(' in 'baseline'
[h264_omx @ 0x247f440] Unable to parse option value "baseline"
[h264_omx @ 0x247f440] Error setting option profile to value baseline.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_mmal) -> h264 (h264_omx))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
ffmpeg version 3.2.10-1~deb9u1+rpt1

Next, I tried simply passing the profile number (66) as -profile:v 66
This didn't yield an error, but the video was not encoded in baseline profile - instead it used Profile High 10.

In omx.c, there appears to be support for Baseline, Main and High profiles (https://github.com/FFmpeg/FFmpeg/blob/a ... omx.c#L528). But I simply can't figure out how to pass this into the encoder from ffmpeg.

Thanks for any pointers.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6063
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How to specify baseline profile from ffmpeg?

Tue Sep 25, 2018 3:03 pm

(More of an FFmpeg problem than an OpenMax one)
Please provide the exact command-line you are entering. ffmpeg is very fussy about the order of options on the command-line.

https://superuser.com/questions/563997/ ... peg#564007 would imply

Code: Select all

ffmpeg -i input.mp4 -c:v h264_omx -profile:v base -level:v 4.0 output.mp4
should do it.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rgriggs
Posts: 5
Joined: Mon Aug 27, 2018 10:15 pm

Re: How to specify baseline profile from ffmpeg?

Tue Sep 25, 2018 3:08 pm

Thank you so much for a fast reply!
Sorry if I posted in the wrong forum area. I wasn't sure the best place to post this question. If I need to move it, just let me know where.

Here is the command line:

Code: Select all

ffmpeg -c:v h264_mmal -i "rtsp://192.168.1.115:554/stream0" -c:v h264_omx -profile:v base -level:v 4.0 test.h264

Still getting this error:

Code: Select all

[h264_omx @ 0x1785210] [Eval @ 0x7eeb62e0] Undefined constant or missing '(' in 'base'
[h264_omx @ 0x1785210] Unable to parse option value "base"
[h264_omx @ 0x1785210] Error setting option profile to value base.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_mmal) -> h264 (h264_omx))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
It's like it doesn't know what to do with the word "base".

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6063
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How to specify baseline profile from ffmpeg?

Tue Sep 25, 2018 3:40 pm

My bad - it should be baseline, not base.

It looks like each individual codec module is responsible for parsing the command-line arguments, so they could vary between codecs implementations.
https://github.com/FFmpeg/FFmpeg/blob/a ... omx.c#L918 lists the parameters that are supported, and

Code: Select all

./ffmpeg -c:v h264_mmal -i /opt/vc/src/hello_pi/hello_video/test.h264 -c:v h264_omx -profile:v baseline foo.h264
works for me with the version ffmpeg I've built from source (https://github.com/FFmpeg/FFmpeg/commit ... a12e9fcae9 was top of tree, with a couple of patches on top).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rgriggs
Posts: 5
Joined: Mon Aug 27, 2018 10:15 pm

Re: How to specify baseline profile from ffmpeg?

Tue Sep 25, 2018 3:48 pm

Thank you for the reply. It must be a bug in my version of ffmpeg, because I have tried "base", "baseline", "Baseline", and the constant name FF_PROFILE_H264_BASELINE as well.

I will try to build the most recent version and see if the problem goes away.

Thanks for your time!

Return to “OpenMAX”