Das Trimmen von AVI-Video über FFMPEG führt zu Schwarzbildvideo, aber das Audio ist in Ordnung

525
mipi

Ich möchte ein AVI-Video (H264-Codec) über ffmpeg trimmen. Das Zeitintervall für das Ergebnis ist als START_TIME_ORIG und DURATION_ORIG (beide in Mikrosekunden) verfügbar. Um sicherzustellen, dass das resultierende Video mit einem IDR-Frame beginnt, bestimme ich START_TIME und DURATION über ffprobe durch Ausführen

ffprobe -show_frames -pretty -read_intervals [TIME_FROM%TIME_TO] input.avi 

zweimal, um die IDR-Frames zu erhalten, die (erster Aufruf) am nächsten an START_TIME_ORIG liegen und (zweiter Aufruf) am nächsten an START_TIME_ORIG + DURATION_ORIG liegen. TIME_FROM und TIME_TO ist ein Intervall von 5 Sekunden plus / minus um (1. Aufruf) START_TIME_ORIG und (2. Aufruf) START_TIME_ORIG + DURATION_ORIG. Um einen Frame als IDR-Frame zu identifizieren, vergewissere ich mich, dass key_frame = 1 und pict_type = I ist. START_TIME wird dann auf pkt_dts_time dieses Frames gesetzt. Auf ähnliche Weise berechne ich DAUER.

Dann heißt ffmpeg:

ffmpeg -ss [START_TIME] -i input.avi -t [DURATION] -codec copy -reset_timestamps 1 -async 1 -map 0 -y output.avi 

Leider hat das resultierende Video nur einen schwarzen Bildschirm, der Ton ist in Ordnung. Was ist falsch an meinem Ansatz? Danke, Mipi

BTW: Das ist die Ausgabe von ffmpeg

 ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7.2.1 (GCC) 20171128 configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-shared --enable-version3 libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Invalid return value 0 for stream protocol Last message repeated 1 times Input #0, avi, from '/home/mipi/Videos/OTR/Bruder_Schwarze_Macht_17.10.29_21-45_zdfneo_45_TVOON_DE.mpg.HQ.avi': Metadata: comment : Auge um Auge Deutschland 2017|Die Deutsch-Türkin Sibel, 34, fühlt sich als Polizistin gut integriert. Ihr Bruder Melih, 21, empfindet anders: Sie seien nur die "ewigen Türken". Beide sind wie Feuer und Wasser.|Melih sucht seinen Platz. Mit Freund Tobi  title : Bruder - Schwarze Macht encoder : Lavf54.17.100 encoded_by : www.onlinetvrecorder.com Duration: 01:00:47.64, start: 0.000000, bitrate: 985 kb/s Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(tv, bt470bg, progressive), 720x576 [SAR 64:45 DAR 16:9], 780 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 192 kb/s Output #0, avi, to '/home/mipi/Videos/OTR/Cut/Bruder_Schwarze_Macht_17.10.29_21-45_zdfneo_45_TVOON_DE.mpg.HQ.avi': Metadata: ICMT : Auge um Auge Deutschland 2017|Die Deutsch-Türkin Sibel, 34, fühlt sich als Polizistin gut integriert. Ihr Bruder Melih, 21, empfindet anders: Sie seien nur die "ewigen Türken". Beide sind wie Feuer und Wasser.|Melih sucht seinen Platz. Mit Freund Tobi  INAM : Bruder - Schwarze Macht ITCH : www.onlinetvrecorder.com ISFT : Lavf57.83.100 Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(tv, bt470bg, progressive), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 780 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 192 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [avi @ 0x5590b071a3c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly frame=43401 fps=0.0 q=-1.0 size= 203531kB time=00:28:45.96 bitrate= 966.0kbits/frame=66964 fps=0.0 q=-1.0 Lsize= 303964kB time=00:44:28.48 bitrate= 933.1kbits/s speed=3.47e+03x  video:236957kB audio:62779kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.410803% 
1
Spielen Sie mit ffplay und prüfen Sie. Gyan vor 6 Jahren 0
Gelöst: Das resultierende Video kann mit VLC und ffplay ausgeführt werden. Es scheint also ein Problem des Gnome Video Players zu sein. @ Mulvya: Danke. mipi vor 6 Jahren 0

0 Antworten auf die Frage