ibllib.io.ffmpeg

Functions

compress

runs a command of the form 'ffmpeg -i {file_in} -c:a flac -nostats {file_out}' using a supbprocess audio compression for ephys: "ffmpeg -i {file_in} -c:a flac -nostats {file_out}" video compression for ephys: "('ffmpeg -i {file_in} -codec:v libx264 -preset slow -crf 17 ' '-nostats -loglevel 0 -codec:a copy {file_out}')"

iblrig_video_compression

Compresses avi files from the raw_video_data folder into mp4.

compress(file_in, file_out, command, remove_original=True)[source]

runs a command of the form ‘ffmpeg -i {file_in} -c:a flac -nostats {file_out}’ using a supbprocess audio compression for ephys: “ffmpeg -i {file_in} -c:a flac -nostats {file_out}” video compression for ephys: `”(‘ffmpeg -i {file_in} -codec:v libx264 -preset slow -crf 17 ‘

‘-nostats -loglevel 0 -codec:a copy {file_out}’)”`

Parameters:
  • file_in – full file path of input

  • file_out – full file path of output

  • command – string ready to be formatted with file_in and file_out

  • remove_original – if true, remove uncompressed file

return: file_out

iblrig_video_compression(session_path, command, verify_output=True)[source]

Compresses avi files from the raw_video_data folder into mp4. Once the compression completes the avi file is removed. If mp4 already exist, the funciton returns their file path

Parameters:
  • session_path – the session directory path

  • command – string ready to be formatted with file_in and file_out

  • verify_output – if true assert that output video is readable

for ephys: >>> command = (‘ffmpeg -i {file_in} -y -codec:v libx264 -preset slow -crf 17 ‘ >>> ‘-nostats -loglevel 0 -codec:a copy {file_out}’) for training: >>> command = (‘ffmpeg -i {file_in} -y -codec:v libx264 -preset slow -crf 29 ‘ >>> ‘-nostats -loglevel 0 -codec:a copy {file_out}’) :return: list of compressed files