staging.inyokaproject.org

gesamte Laufzeit von Videos und Audio ermitteln

Status: Gelöst | Ubuntu-Version: Kubuntu 20.04 (Focal Fossa)
Antworten |

gerold123

Avatar von gerold123

Anmeldungsdatum:
18. April 2006

Beiträge: 1355

Hallo,

wie kann ich per Terminal die Laufzeit/Abspieldauer aller Videos in einem Unterverzeichnis ermitteln? Beispiel:

ls Blackout_kpl/
'Blackout Folge 1.mp4'  'Blackout Folge 3.mp4'  'Blackout Folge 5.mp4'
'Blackout Folge 2.mp4'  'Blackout Folge 4.mp4'  'Blackout Folge 6.mp4'

Danke

Doc_Symbiosis

Avatar von Doc_Symbiosis

Anmeldungsdatum:
11. Oktober 2006

Beiträge: 4453

Z.B. so:

for file in Blackout_kpl/*.mp4; do mediainfo --Inform="Video;%Duration%" "$file" ; done  | paste -sd+ | bc

Das Ergebnis ist dann in Mikrosekunden. mediainfo musst Du ggf. noch installieren.

gerold123

(Themenstarter)
Avatar von gerold123

Anmeldungsdatum:
18. April 2006

Beiträge: 1355

mediainfo ~/Videos/Blackout_kpl --Inform="Video;%Duration%" "$file" | paste -sd+ | bc
275868026746002866560281292027685602804720

das ist zwar alles schön und gut ...

Doc_Symbiosis

Avatar von Doc_Symbiosis

Anmeldungsdatum:
11. Oktober 2006

Beiträge: 4453

Das war auch nicht der Befehl, den ich Dir angegeben habe. Mit leerer Variable $file wird das etwas schwierig.

gerold123

(Themenstarter)
Avatar von gerold123

Anmeldungsdatum:
18. April 2006

Beiträge: 1355

...und wenn man auf dem Schlauch steht:

tuxracer@kubuntu:~$ mediainfo ~/Videos/Blackout_kpl/
General
Complete name                            : /home/tuxracer/Videos/Blackout_kpl/Blackout Folge 1.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 1.03 GiB
Duration                                 : 45 min 58 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 3 202 kb/s
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 45 min 58 s
Bit rate mode                            : Constant
Bit rate                                 : 3 000 kb/s / 3 000 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.130
Stream size                              : 987 MiB (94%)
Writing library                          : x264 core 161
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=16 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=50 / keyint_min=5 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=1 / bitrate=3000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / vbv_maxrate=3000 / vbv_bufsize=6000 / nal_hrd=cbr / filler=1 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 45 min 58 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 63.1 MiB (6%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

General
Complete name                            : /home/tuxracer/Videos/Blackout_kpl/Blackout Folge 2.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 1 021 MiB
Duration                                 : 44 min 34 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 3 201 kb/s
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Format settings, GOP                     : M=4, N=50
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 44 min 34 s
Bit rate mode                            : Constant
Bit rate                                 : 3 000 kb/s / 3 000 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.130
Stream size                              : 957 MiB (94%)
Writing library                          : x264 core 161
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=19 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=50 / keyint_min=5 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=1 / bitrate=3000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / vbv_maxrate=3000 / vbv_bufsize=6000 / nal_hrd=cbr / filler=1 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 44 min 34 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 61.2 MiB (6%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

General
Complete name                            : /home/tuxracer/Videos/Blackout_kpl/Blackout Folge 3.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 1.07 GiB
Duration                                 : 47 min 46 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 3 201 kb/s
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 47 min 46 s
Bit rate mode                            : Constant
Bit rate                                 : 3 000 kb/s / 3 000 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.130
Stream size                              : 1.00 GiB (94%)
Writing library                          : x264 core 161
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=16 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=50 / keyint_min=5 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=1 / bitrate=3000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / vbv_maxrate=3000 / vbv_bufsize=6000 / nal_hrd=cbr / filler=1 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 47 min 46 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 65.6 MiB (6%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

General
Complete name                            : /home/tuxracer/Videos/Blackout_kpl/Blackout Folge 4.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 1.05 GiB
Duration                                 : 46 min 52 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 3 201 kb/s
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Format settings, GOP                     : M=4, N=50
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 46 min 52 s
Bit rate mode                            : Constant
Bit rate                                 : 3 000 kb/s / 3 000 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.130
Stream size                              : 1 006 MiB (94%)
Writing library                          : x264 core 161
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=16 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=50 / keyint_min=5 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=1 / bitrate=3000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / vbv_maxrate=3000 / vbv_bufsize=6000 / nal_hrd=cbr / filler=1 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 46 min 52 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 64.4 MiB (6%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

General
Complete name                            : /home/tuxracer/Videos/Blackout_kpl/Blackout Folge 5.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 1.03 GiB
Duration                                 : 46 min 8 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 3 202 kb/s
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 46 min 8 s
Bit rate mode                            : Constant
Bit rate                                 : 3 000 kb/s / 3 000 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.130
Stream size                              : 991 MiB (94%)
Writing library                          : x264 core 161
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=16 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=50 / keyint_min=5 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=1 / bitrate=3000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / vbv_maxrate=3000 / vbv_bufsize=6000 / nal_hrd=cbr / filler=1 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 46 min 8 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 63.4 MiB (6%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

General
Complete name                            : /home/tuxracer/Videos/Blackout_kpl/Blackout Folge 6.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 1.05 GiB
Duration                                 : 46 min 44 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 3 202 kb/s
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Format settings, GOP                     : M=4, N=50
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 46 min 44 s
Bit rate mode                            : Constant
Bit rate                                 : 3 000 kb/s / 3 000 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.130
Stream size                              : 1 004 MiB (94%)
Writing library                          : x264 core 161
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=19 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=50 / keyint_min=5 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=1 / bitrate=3000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / vbv_maxrate=3000 / vbv_bufsize=6000 / nal_hrd=cbr / filler=1 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 46 min 44 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 64.2 MiB (6%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1


tuxracer@kubuntu:~$ 

verdooft

Anmeldungsdatum:
15. September 2012

Beiträge: 4450

Wenn dir das reicht, wolltest du nicht die Gesamtlaufzeit, sondern die einzelnen Laufzeiten der Videos im Verzeichnis. Zur Ermittlung der Gesamtlaufzeit habe ich den Post gefunden:

https://unix.stackexchange.com/questions/170961/get-total-duration-of-video-files-in-a-directory

Die Variante mit ffprobe funktioniert bei mir auch.

gerold123

(Themenstarter)
Avatar von gerold123

Anmeldungsdatum:
18. April 2006

Beiträge: 1355

verdooft schrieb:

Zur Ermittlung der Gesamtlaufzeit habe ich den Post gefunden:

Danke

exiftool -n -q -p '${Duration;our $sum;$_=ConvertDuration($sum+=$_)
                    }' ./*.mp3| tail -n1
16 days 13:06:52

👍

shiro Team-Icon

Supporter

Anmeldungsdatum:
20. Juli 2020

Beiträge: 1303

Ich greife noch mal die Idee von Doc_Symbiosis auf.

find ~/Videos/Blackout_kpl/ -iname "*.mp4" -exec mediainfo --Inform="Video;%Duration%" {} \; | awk '{t+=$1} END {n=split(strftime("%j %T",t/1000,1),tt); print tt[1]-1, tt[2]}'
find ~/Musik/ -iname "*.mp3" -exec mediainfo --Inform="Audio;%Duration%" {} \; | awk '{t+=$1} END {n=split(strftime("%j %T",t/1000,1),tt); print tt[1]-1, tt[2]}'

Das Ergebnis ist "dd HH:MM:SS". Falls erforderlich, kann man im awk statt des "print" auch ein "printf" mit erweiterter Formatierung nutzen.

gerold123

(Themenstarter)
Avatar von gerold123

Anmeldungsdatum:
18. April 2006

Beiträge: 1355

shiro schrieb:

Ich greife noch mal die Idee von Doc_Symbiosis auf.

vielen lieben Dank 👍

find ~/Musik/ -iname "*.mp3" -exec mediainfo --Inform="Audio;%Duration%" {} \; | awk '{t+=$1} END {n=split(strftime("%j %T",t/1000,1),tt); print tt[1]-1, tt[2]}'
12 23:23:35
Antworten |