int thread_func()
{
- auto format_ctx = avformat_open_input_unique("example.mp4", nullptr, nullptr);
+ auto format_ctx = avformat_open_input_unique("multiangle.mp4", nullptr, nullptr);
if (format_ctx == nullptr) {
fprintf(stderr, "%s: Error opening file\n", "example.mp4");
return 1;
}
+ int64_t last_pts = -1;
+
for ( ;; ) {
AVPacket pkt;
unique_ptr<AVPacket, decltype(av_packet_unref)*> pkt_cleanup(
global_mainwindow->ui->input1_display->setFrame(pkt.stream_index, pkt.pts);
} else if (pkt.stream_index == 1) {
global_mainwindow->ui->input2_display->setFrame(pkt.stream_index, pkt.pts);
+ } else if (pkt.stream_index == 2) {
+ global_mainwindow->ui->input3_display->setFrame(pkt.stream_index, pkt.pts);
}
});
assert(pkt.stream_index < MAX_STREAMS);
frames[pkt.stream_index].push_back(pkt.pts);
- this_thread::sleep_for(milliseconds(1000) / 120);
+ // Hack. Assumes a given timebase.
+ if (last_pts != -1) {
+ this_thread::sleep_for(microseconds((pkt.pts - last_pts) * 1000000 / 12800));
+ }
+ last_pts = pkt.pts;
}
return 0;
--- /dev/null
+youtube-dl 'https://www.youtube.com/watch?v=Wa2fBiCEzTc'
+FILE='MULTI ANGLE _ George Evans pops up with a 92nd-minute winner in Blackburn!-Wa2fBiCEzTc.mp4'
+ffmpeg -y -ss 0:03.290 -t 0:37 -i "$FILE" -c:v mjpeg -an angle1.mp4
+ffmpeg -y -ss 0:40 -t 0:40 -i "$FILE" -c:v mjpeg -an angle2.mp4
+ffmpeg -y -ss 1:12.880 -i "$FILE" -c:v mjpeg -an angle3.mp4
+ffmpeg -y -ss 0:07 -i ./angle3.mp4 -c:v copy -copyts -start_at_zero angle3-cut.mp4
+ffmpeg -y -copyts -i angle1.mp4 -i angle2.mp4 -i angle3-cut.mp4 -map 0:0 -map 1:0 -map 2:0 -c:v copy multiangle.mp4
+
<widget class="QWidget" name="verticalLayoutWidget_4">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
- <widget class="QTableView" name="tableView"/>
+ <widget class="QTableWidget" name="clip_list">
+ <column>
+ <property name="text">
+ <string>In</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Out</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Duration</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Camera 1</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Camera 2</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Camera 3</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Camera 4</string>
+ </property>
+ </column>
+ </widget>
</item>
<item>
- <widget class="QTableView" name="tableView_2"/>
+ <widget class="QTableWidget" name="playlist">
+ <column>
+ <property name="text">
+ <string>In</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Out</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Duration</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Camera</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ </column>
+ </widget>
</item>
</layout>
</widget>