Ivf (ivf v0.2.0)

Collection of convenience functions to work with IVF files as described here: https://wiki.multimedia.cx/index.php/Duck_IVF.

reading-files

Reading Files

{props, stream} = Ivf.stream!("test/videos/test_vp8.ivf")
%Ivf.Props{
  width: 320,
  height: 180,
  time_base: {1, 5},
  frame_count: 280,
  codec: "VP80"
} = props
200 = stream |> Enum.to_list |> length


writing-files

Writing Files

file = File.open!("test/videos/out.ivf", [:binary, :write])
writer = Ivf.write!(file, Ivf.Props.new([]))
# File will not be written to until frames are appended
{:ok, %File.Stat{size: 0}} = File.stat("test/videos/out.ivf")
# writer accepts any binary or list
writer = Ivf.Writer.append(writer, "invalid_test_frame")
# time stamps can also be provided
writer = Ivf.Writer.append(writer, {1, "invalid_test_frame"})
writer = Ivf.Writer.append(writer, {3, "invalid_test_frame"})
# close the writer, the frame count in the header will be adjusted
:ok = Ivf.Writer.close(writer)

Link to this section Summary

Functions

Open an IVF file and lazy stream all frames.

Create a new IVF file.

Link to this section Functions

@spec stream!(binary() | pid()) :: {Ivf.Props.t(), Stream.t()}

Open an IVF file and lazy stream all frames.

Link to this function

write!(file, props)

@spec write!(binary() | pid(), Ivf.Props.t()) :: Ivf.Writer.t()

Create a new IVF file.