VideoHelp Forum
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. I know I could (may be should) have posted this in the Mac section, but I decided against it since it's partly a general question.

    background:
    I'm trying to get hardware encoding working on my mac which works through the use of the videotoolbox API, which ffmpeg/libav supports (https://github.com/FFmpeg/FFmpeg/tree/master/libavcodec)

    I did a blind test using:
    Code:
    ffmpeg -y -threads 8 -i "公演后感言.mp4" -map 0:0 -an -sn  -vsync 0 -pix_fmt yuv420p  -vcodec h264_videotoolbox -bitrate 1500  "/temp/公演后感言_21_32_47_7210_01.264
    and the encoding worked fine.
    Problem is: What options are available through ffmpeg in regard to videotoolbox.

    Here's what I know:
    • '-vcodec X': allows to select the output type (h264_videotoolbox for H.264, hevc_videotoolbox for H.265)
    • for HEVC:
      Code:
      Supported pixel formats: videotoolbox_vld nv12 yuv420p
      hevc_videotoolbox AVOptions:
        -profile           <int>        E..V.... Profile (from 0 to 3) (default 0)
           main                         E..V.... Main Profile
           main10                       E..V.... Main10 Profile
        -allow_sw          <boolean>    E..V.... Allow software encoding (default false)
        -realtime          <boolean>    E..V.... Hint that encoding should happen in real-time if not faster (e.g. capturing from camera). (default false)
        -frames_before     <boolean>    E..V.... Other frames will come before the frames in this session. This helps smooth concatenation issues. (default false)
        -frames_after      <boolean>    E..V.... Other frames will come after the frames in this session. This helps smooth concatenation issues. (default false)
    • for AVC:
      Code:
          Supported pixel formats: videotoolbox_vld nv12 yuv420p
      h264_videotoolbox AVOptions:
        -profile           <int>        E..V.... Profile (from 0 to 4) (default 0)
           baseline                     E..V.... Baseline Profile
           main                         E..V.... Main Profile
           high                         E..V.... High Profile
        -level             <int>        E..V.... Level (from 0 to 52) (default 0)
           1.3                          E..V.... Level 1.3, only available with Baseline Profile
           3.0                          E..V.... Level 3.0
           3.1                          E..V.... Level 3.1
           3.2                          E..V.... Level 3.2
           4.0                          E..V.... Level 4.0
           4.1                          E..V.... Level 4.1
           4.2                          E..V.... Level 4.2
           5.0                          E..V.... Level 5.0
           5.1                          E..V.... Level 5.1
           5.2                          E..V.... Level 5.2
        -coder             <int>        E..V.... Entropy coding (from 0 to 2) (default 0)
           cavlc                        E..V.... CAVLC entropy coding
           vlc                          E..V.... CAVLC entropy coding
           cabac                        E..V.... CABAC entropy coding
           ac                           E..V.... CABAC entropy coding
        -a53cc             <boolean>    E..V.... Use A53 Closed Captions (if available) (default true)
        -allow_sw          <boolean>    E..V.... Allow software encoding (default false)
        -realtime          <boolean>    E..V.... Hint that encoding should happen in real-time if not faster (e.g. capturing from camera). (default false)
        -frames_before     <boolean>    E..V.... Other frames will come before the frames in this session. This helps smooth concatenation issues. (default false)
        -frames_after      <boolean>    E..V.... Other frames will come after the frames in this session. This helps smooth concatenation issues. (default false)
    I also know that I can set a target bitrate using '-c:v X', but what other options are there? Can I set an aspect ratio? A max bitrate? ...
    What are the options that are available to both encoders?
    • '-c:v X' to set the bitrate
    • '-g X' to set the gop size, '-g 1' will be I-Frame only encoding.
    • .. help

    Has anyone some more experience with this and can lend a helping hand?
    Since I normally don't use ffmpeg for encoding video I'm a bit at a loss here and would be happy to get some help.

    Cu Selur
    Last edited by Selur; 3rd Jan 2018 at 16:17.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  2. Explorer Case's Avatar
    Join Date
    Feb 2004
    Location
    Middle Earth
    Search Comp PM
    Pretty cool to use hardware encoding like that. I hadn’t done that before. It is pretty fast compared to regular libx264 encoding (2.7x faster), although it needs more quality tweaking than libx264, as the defaults produces low quality video.
    A lot of global options can be set as usual:
    -c:v sets the video codec, what used to be -vcodec
    -b:v sets the bitrate, used to be -b (unit is bits/sec now, so include a ‘k’, like: 1500k)
    -vf setdar for aspect ratio, used to be -aspect (-vf scale=1920:1080,setdar=16:9 use comma for combination with scaling)
    ffmpeg ignores the -bitrate option (I don't think it is valid)
    h264_videotoolbox seems to ignore the -x264-params option (maybe only valid for libx264 ?)
    h264_videotoolbox seems to ignore the -intra shorthand (works for libx264)
    Quote Quote  
  3. quick kook at https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/videotoolbox.c
    there should be options to set:
    hevc: tier

    -x264-params option (maybe only valid for libx264 ?)
    yes, that I expected
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!