Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

OSX example fails with panic: time: invalid duration "NaNs" #8

Open
xackery opened this issue Feb 5, 2022 · 5 comments
Open

OSX example fails with panic: time: invalid duration "NaNs" #8

xackery opened this issue Feb 5, 2022 · 5 comments

Comments

@xackery
Copy link

xackery commented Feb 5, 2022

tried multiple files, same error.

go run main.go
Duration: 2m30.102176s
Format name: mov,mp4,m4a,3gp,3g2,mj2
Format long name: QuickTime / MOV
MIME type: 
Number of streams: 2

panic: time: invalid duration "NaNs"

goroutine 1 [running]:
main.handleError(...)
        <omitted>/main.go:142
main.main()
        <omitted>/main.go:28 +0x11bf
exit status 2
------
Duration: 4m0.140416s
Format name: matroska,webm
Format long name: Matroska / WebM
MIME type: audio/webm,audio/x-matroska,video/webm,video/x-matroska
Number of streams: 2

panic: time: invalid duration "NaNs"

goroutine 1 [running]:
main.handleError(...)
       <omitted>/main.go:142
main.main()
        <omitted>/main.go:28 +0x11bf
exit status 2

I ran libav as the README noted:

🍺  /usr/local/Cellar/libav/12.3_8: 15 files, 32.4MB
==> Running `brew cleanup libav`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> No outdated dependents to upgrade!
==> Checking for dependents of upgraded formulae...
Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Reinstalling 1 dependent with broken linkage from source:
libav
Warning: libav has been deprecated because it is not maintained upstream!
@zergon321
Copy link
Owner

Could you please provide the output of ffmpeg -i your_video.ext command for each video you tried to use with the examples? Also I would like to know how you obtained those media files. Did you download them from the Internet or recorded them yourself with some device? Some devices may not write the proper metadata to the media file.

@xackery
Copy link
Author

xackery commented Feb 5, 2022

it's your examples. From https://github.com/zergon321/reisen/blob/master/examples/analyze/demo.mp4 and https://github.com/zergon321/reisen/blob/master/examples/analyze/demo.mkv

ffmpeg -i demo.mp4
ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.0.0 (clang-1300.0.29.3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'demo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:25.63, start: 0.000000, bitrate: 2420 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, 2209 kb/s, 29.98 fps, 30 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 209 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
At least one output file must be specified
-------
ffmpeg -i demo.mkv
ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.0.0 (clang-1300.0.29.3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Input #0, matroska,webm, from 'demo.mkv':
  Metadata:
    COMPATIBLE_BRANDS: isomiso2avc1mp41
    MAJOR_BRAND     : isom
    MINOR_VERSION   : 512
    ENCODER         : Lavf58.76.100
  Duration: 00:00:25.64, start: 0.000000, bitrate: 2671 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 30 fps, 30 tbr, 1k tbn (default)
    Metadata:
      HANDLER_NAME    : VideoHandler
      VENDOR_ID       : [0][0][0][0]
      ENCODER         : Lavc58.134.100 libx264
      DURATION        : 00:00:25.636000000
  Stream #0:1: Audio: vorbis, 44100 Hz, stereo, fltp (default)
    Metadata:
      HANDLER_NAME    : SoundHandler
      VENDOR_ID       : [0][0][0][0]
      ENCODER         : Lavc58.134.100 libvorbis
      DURATION        : 00:00:25.638000000
At least one output file must be specified

@xackery
Copy link
Author

xackery commented Feb 5, 2022

I took your example here: https://github.com/zergon321/reisen/blob/master/examples/analyze/main.go
downloaded the demo.mp4 and demo.mkv files, and ran it. Only renamed the media, err := reisen.NewMedia("demo.mp4") path to .mkv extension to test the other, but seems to totally not work in my environment.

@zergon321
Copy link
Owner

Well, regrettably, I don't own an OS X device to properly test it. I debugged the analyze example and everything was fine.

Screenshot_20220206_211947

Could you please do the same debugging process so I could see what's not being read properly? The tm variable becomes NaN at the end of the function call for some reason.

@samhocevar
Copy link
Contributor

Just my two cents: the only way for tm to become NaN in this codepath is if both tmNum and tmDen are zero.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants