miratape is a console application to play back, record (by launching a Framework) or to manipulate tapes.
Note: Alternatively, tapes can be recorded and played back using the TapeRecorder and TapePlayer view of miracenter. Tapes can also be edited using the TapeEditor view plugin of miracenter.
Running miratape
If you have the path to the binaries of your MIRA installation included in your PATH environment variable then you can typically use the command:
If not you have to specify the full path to the miratape binary:
/path/to/miraroot/bin/miratape params
Parameters
For recording and playing back tapes miratape starts a Framework. So the same command line parameters as for mira and miragui can be used.
miratape can also be used to repair corrupt tapes, to copy tapes or part of tapes into other tapes or to extract a series of images from image channels.
In the following some of the parameters are listed. Launch
or
to see a full list of command line parameters and their explanation.
- info <tapefile> : displays information about the tape
–metadb : include the metatype database (merged over all channels) in output
–json : output info in JSON format
- rec <tapefile>: records channels to tape
–channels "channel1,channel2,..." : The channels to record
–messageblocksize : the maximum size of a message block in kB of the new tape file (default is 64 MB). A message block represents
a chunk of messages in a tape that are loaded into memory when playing back a tape. This speeds up opening a tape and reduces harddrive access.
- repair <inputtapefile> <outputtapefile>: try to repair a tape
- play tapefile : play a tape. More options are:
–close_when_finished : closes miratape after play back finished
–use_original_timestamp : use the original recording time as base for play back - default=false
–loop : play in a loop (disables close_when_finished)
–channels "channel1,channel2,..." : limit playback to given channels
–channels_not "channel1,channel2,..." : play all but given channels (ignored if '–channels' option is used)
–first : specify relative time of first message to play in microseconds
–last : specify relative time of last message to play in microseconds
–time_scale : The scale factor for play back (1 = normal play back) - default=1)
–play_also : Additional file(s) to play together with the selected tapefile
–crop_relative_to_main_tape: 'first'/'last' is relative to main tape recording time (default: relative to each individual tape)
–namespace_prefix : An optional namespace prefix
- copy <inputtapefile> <outputtapefile>: copy tape file to a new one while optionally filtering and cutting the content. More options are:
–channels "channel1,channel2,..." : write the given channels only
–channels_not "channel1,channel2,..." : write all but the given channels (ignored if '–channels' option is used)
–compress ["channel1,channel2,..."] : specify the channels that should be stored compressed, if no channels are specified, all channels will be compressed
–rename from1=to1,from2=to2,... : replace all occurrences of 'from' by 'to' in the stored channel names
–retype from1=to1,from2=to2,... : replace all occurrences of 'from' by 'to' in the stored type names (removes all meta data information for retyped channels)
–addformatversion : add format version number to start of serialized data (only for legacy format tapes!)
–addversion "class[=version[,position]]" : add a version number to all occurrences of the named class (see Serialization_AddVersion)
–first : specify relative time of first message to copy in microseconds
–first_and_rectime : like –first, but also offset recording time (overrides –first, –recordingtime, –shiftmessageoffset)
–last : specify relative time of last message to copy in microseconds
–recordingtime : set the recording time to the specified value given as timestamp in microseconds
–shiftmessageoffset : adjust the time offset relative to the recording time of each message (given in microseconds)
–messageblocksize : the maximum size of a message block in kB of the new tape file (default is 64 MB). A message block represents
a chunk of messages in a tape that are loaded into memory when playing back a tape. This speeds up opening a tape and reduces harddrive access.
–drop_same_timestamp n: drop message if same timestamp appeared in same channel within last n messages
- transcode <inputtapefile> <outputtapefile> : transcodes the specified channels using a different codec
–channels "channel1=codec1,channel2=codec2" : the channels and the target codecs. if no codec is given, no compression is used.
- merge <inputtapefileA> <inputtapefileB> <outputtapefile> : merge two tape files to a new one.
–first : specify relative time of first message to play in microseconds
–last : specify relative time of last message to play in microseconds
–merge_also : Additional file(s) to merge into the new tape
–crop_relative_to_main_tape: 'first'/'last' is relative to tape A recording time (default: relative to each individual tape)
- writeJSON <tapefile> <outputfile> : writes tapefile in JSON format.
–channels "channel1,channel2,..." : use the given channels only
–channels_not "channel1,channel2,..." : write all but given channels (ignored if '–channels' option is used)
–first : specify relative time of first message to copy in microseconds
–last : specify relative time of last message to copy in microseconds
–matlab : write timestamps, channel values and frame ids as distinct arrays. This can significantly speed up matlab import (e.g. using jsonlab toolbox).
- extractimages <tapefile> <imagedirectory>: writes all images stored in the specified tape into the given image directory. More options are:
–channels "channel1,channel2,..." : use the given channels only
–first : specify relative time of first message to copy in microseconds
–last : specify relative time of last message to copy in microseconds
–scale factor : scale factor 'alpha' for cv::Mat::convertTo()
–format [jpg/png/png16...] : image format that is used (png16 is 16bit png)
- extractvideo <tapefile> <videofilename> : writes all images stored in the specified tape into a video.
–channels "channel1,channel2,..." : use the given channels only
–first : specify relative time of first message to copy in microseconds
–last : specify relative time of last message to copy in microseconds
–skip : specify number of images to skip at beginning of tape
–codec : specify video codec - available codecs depend on your installed mira packages (e.g. FFmpeg).
Codecs may define specific parameters, e.g. –framerate, –bitrate. Check output of 'miratape –help'