Server: Rewrite and update ffmpeg producer

Created on 12 Oct 2017  路  9Comments  路  Source: CasparCG/server

The current implementation uses a very old API and needs update.

ffmpeg-consumer

Most helpful comment

Please use ffmpeg 3.4 (or higher) as it includes some important quality improvements for broadcast grade applications such as fixed scaling and the updated _bwdif_ deinterlacer as drop-in replacement for _yadif_.

All 9 comments

Please use ffmpeg 3.4 (or higher) as it includes some important quality improvements for broadcast grade applications such as fixed scaling and the updated _bwdif_ deinterlacer as drop-in replacement for _yadif_.

If this is done please ad support for the HAP / HAP Q codec (currently supported by FFMPEG with libsnappy) using the GPU for decoding

Please consider #266 as well.

@ronag ronag removed their assignment 6 days ago

@ronag does that mean you are not going to work on it? Did something change?

@dimitry-ishenko mistake

Hi! Just so we remember to test for these things.

From the terminal:
help producer ffmpeg producer

FFmpeg Producer

Syntax:
  [clip,url:string] {[loop:LOOP]} {IN,SEEK [in:int]} {OUT [out:int] | LENGTH
  [length:int]} {FILTER [filter:string]} {CHANNEL_LAYOUT
  [channel_layout:string]}

The FFmpeg Producer can play all media that FFmpeg can play, which includes many
QuickTime video codec such as Animation, PNG, PhotoJPEG, MotionJPEG, as well as
H.264, FLV, WMV and several audio codecs as well as uncompressed audio.

  clip
    The file without the file extension to play. It should reside under the
    media folder.
  url
    If clip contains :// it is instead treated as the URL parameter. The URL can
    either be any streaming protocol supported by FFmpeg,
    dshow://video={webcam_name} or v4l2://{video device} or iec61883://{auto}.
  loop
    Will cause the media file to loop between in and out.
  in
    Optionally sets the first frame. 0 by default. If loop is specified, this
    will be the frame where it starts over again.
  out
    Optionally sets the last frame. If not specified the clip will be played to
    the end. If loop is specified, the file will jump to start position once it
    reaches the last frame.
  length
    Optionally sets the length of the clip. Equivalent to OUT in + length.
  filter
    If specified, will be used as an FFmpeg video filter.
  channel_layout
    Optionally override the automatically deduced audio channel layout.Either a
    named layout as specified in casparcg.config or in the format
    [type:string]:[channel_order:string] for a custom layout.

Examples:

  >> PLAY 1-10 folder/clip
  ...to play all frames in a clip and stop at the last frame.

  >> PLAY 1-10 folder/clip LOOP
  ...to loop a clip between the first frame and the last frame.

  >> PLAY 1-10 folder/clip LOOP IN 10
  ...to loop a clip between frame 10 and the last frame.

  >> PLAY 1-10 folder/clip LOOP IN 10 LENGTH 50
  ...to loop a clip between frame 10 and frame 60.

  >> PLAY 1-10 folder/clip IN 10 OUT 60
  ...to play frames 10-60 in a clip and stop.

  >> PLAY 1-10 folder/clip FILTER yadif=1,-1
  ...to deinterlace the video.

  >> PLAY 1-10 folder/clip CHANNEL_LAYOUT film
  ...given the defaults in casparcg.config this will specifies that the clip has
  6 audio channels of the type 5.1 and that they are in the order FL FC FR BL BR
  LFE regardless of what ffmpeg says.

  >> PLAY 1-10 folder/clip CHANNEL_LAYOUT "5.1:LFE FL FC FR BL BR"
  ...specifies that the clip has 6 audio channels of the type 5.1 and that they
  are in the specified order regardless of what ffmpeg says.

  >> PLAY 1-10 rtmp://example.com/live/stream
  ...to play an RTMP stream.

  >> PLAY 1-10 "dshow://video=Live! Cam Chat HD VF0790"
  ...to use a web camera as video input on Windows.

  >> PLAY 1-10 v4l2:///dev/video0
  ...to use a web camera as video input on Linux.

  >> PLAY 1-10 iec61883://auto
  ...to use a FireWire (H)DV video device as video input on Linux.

The FFmpeg producer also supports changing some of the settings via CALL:

  >> CALL 1-10 LOOP 1

  >> CALL 1-10 IN 10

  >> CALL 1-10 OUT 60

  >> CALL 1-10 LENGTH 50

  >> CALL 1-10 SEEK 30

Framerate conversion control / Slow motion examples:

  >> CALL 1-10 FRAMERATE INTERPOLATION BLEND2
  ...enables 2 frame blend interpolation.

  >> CALL 1-10 FRAMERATE INTERPOLATION BLEND3
  ...enables 3 frame blend interpolation.

  >> CALL 1-10 FRAMERATE INTERPOLATION DROP_OR_REPEAT
  ...disables frame interpolation.

  >> CALL 1-10 FRAMERATE SPEED 0.25
  ...immediately changes the speed to 25%. Sound will be disabled.

  >> CALL 1-10 FRAMERATE SPEED 0.25 50
  ...changes the speed to 25% linearly over 50 frames. Sound will be disabled.

  >> CALL 1-10 FRAMERATE SPEED 0.25 50 easeinoutsine
  ...changes the speed to 25% over 50 frames using specified easing curve. Sound
  will be disabled.

  >> CALL 1-10 FRAMERATE SPEED 1 50
  ...changes the speed to 100% linearly over 50 frames. Sound will be enabled
  when the destination speed of 100% has been reached.

There is also some undocumented things like:
CALL 1-10 SEEK REL -100

BTW! If you haven't tested the slomo, you should!
Try like this.

CALL 1-10 FRAMERATE SPEED 0.25
CALL 1-10 FRAMERATE INTERPOLATION BLEND2 

(or BLEND3)

Can you provide a windows build with this fix please? Thanks a lot

Should be buildable runnable in debug windows build:

https://github.com/nxtedition/caspar/pull/3

Still some things missing like seeking and looping.

There are now test binaries and a TODO list available at https://github.com/nxtedition/caspar/pull/3 for anyone that wants to help with testing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TKooijmans picture TKooijmans  路  61Comments

petterreinholdtsen picture petterreinholdtsen  路  61Comments

dimitry-ishenko picture dimitry-ishenko  路  28Comments

TomKaltz picture TomKaltz  路  47Comments

ronag picture ronag  路  29Comments