]> git.sesse.net Git - nageru/commitdiff
Add a script for grabbing some example multiangle data off of YouTube.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 9 Jun 2018 09:40:16 +0000 (11:40 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 9 Jun 2018 09:40:16 +0000 (11:40 +0200)
main.cpp
make-example-video.sh [new file with mode: 0644]
ui_mainwindow.ui

index 0a976c3d438994e6c95dce9faabc4556cf766715..526ed575e32581ba6bedee5a63abd9d0ad3e1a86 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -53,12 +53,14 @@ int main(int argc, char **argv)
 
 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(
@@ -85,13 +87,19 @@ int thread_func()
                                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;
diff --git a/make-example-video.sh b/make-example-video.sh
new file mode 100644 (file)
index 0000000..975c7a4
--- /dev/null
@@ -0,0 +1,8 @@
+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 
+
index 778d19fddd94ee0830f1f970365fbc36ed6ef1d8..3d3f0461e3bf7671e8e7d9d83a0583c4ef07a057 100644 (file)
       <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>