apitrace dump-images -o - application.trace \
| ffmpeg -r 30 -f image2pipe -vcodec ppm -i pipe: -vcodec mpeg4 -y output.mp4
+Recording a video with gstreamer
+--------------------------------------
+
+You can make a video of the output with gstreamer by doing
+
+ glretrace --snapshot-format=RGB -s - smokinguns.trace | gst-launch-0.10 fdsrc blocksize=409600 ! queue \
+ ! videoparse format=rgb width=1920 height=1080 ! queue ! ffmpegcolorspace ! queue \
+ ! vaapiupload direct-rendering=0 ! queue ! vaapiencodeh264 ! filesink location=xxx.264
Trimming a trace
----------------
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright (C) 2013 Intel Corporation. All rights reversed.
+ * Author: Shuang He <shuang.he@intel.com>
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <assert.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "image.hpp"
+
+
+namespace image {
+
+void
+Image::writeRAW(std::ostream &os) const {
+ const unsigned char *row;
+
+ for (row = start(); row != end(); row += stride()) {
+ os.write((const char *)row, width*channels);
+ }
+}
+
+} /* namespace image */
static const char *comparePrefix = NULL;
static const char *snapshotPrefix = NULL;
+static enum {
+ PNM_FMT,
+ RAW_RGB
+} snapshotFormat = PNM_FMT;
+
static trace::CallSet snapshotFrequency;
static trace::CallSet compareFrequency;
static trace::ParseBookmark lastFrameStart;
char comment[21];
snprintf(comment, sizeof comment, "%u",
useCallNos ? call_no : snapshot_no);
- src->writePNM(std::cout, comment);
+ if (snapshotFormat == RAW_RGB)
+ src->writeRAW(std::cout);
+ else
+ src->writePNM(std::cout, comment);
} else {
os::String filename = os::String::format("%s%010u.png",
snapshotPrefix,
" --driver=DRIVER force driver type (`hw`, `sw`, `ref`, `null`, or driver module name)\n"
" --sb use a single buffer visual\n"
" -s, --snapshot-prefix=PREFIX take snapshots; `-` for PNM stdout output\n"
+ " --snapshot-format=FMT use (PNM or RGB; default is PNM) when writing to stdout output\n"
" -S, --snapshot=CALLSET calls to snapshot (default is every frame)\n"
" -v, --verbose increase output verbosity\n"
" -D, --dump-state=CALL dump state at specific call no\n"
PPD_OPT,
PMEM_OPT,
SB_OPT,
+ SNAPSHOT_FORMAT_OPT,
LOOP_OPT,
SINGLETHREAD_OPT
};
{"pmem", no_argument, 0, PMEM_OPT},
{"sb", no_argument, 0, SB_OPT},
{"snapshot-prefix", required_argument, 0, 's'},
+ {"snapshot-format", required_argument, 0, SNAPSHOT_FORMAT_OPT},
{"snapshot", required_argument, 0, 'S'},
{"verbose", no_argument, 0, 'v'},
{"wait", no_argument, 0, 'w'},
retrace::verbosity = -2;
}
break;
+ case SNAPSHOT_FORMAT_OPT:
+ if (strcmp(optarg, "RGB") == 0)
+ snapshotFormat = RAW_RGB;
+ else
+ snapshotFormat = PNM_FMT;
+ break;
case 'S':
snapshotFrequency = trace::CallSet(optarg);
if (snapshotPrefix == NULL) {