slhck / ffmpeg-normalize

Audio Normalization for Python/ffmpeg
MIT License
1.25k stars 117 forks source link

Invalid data found when processing input #144

Closed dima-dmytruk23 closed 3 years ago

dima-dmytruk23 commented 3 years ago

I try to normalize .mp4 video file

But when I run ffmpeg-normalize file.mp4 -o file.mp4 -f -c:a aac -b:a 192k or ffmpeg-normalize file.mp4 -o file.mp4 I get error

Traceback (most recent call last):
  File "/home/m0nte-cr1st0/.virtualenvs/hypercube/bin/ffmpeg-normalize", line 8, in <module>
    sys.exit(main())
  File "/home/m0nte-cr1st0/.virtualenvs/hypercube/lib/python3.8/site-packages/ffmpeg_normalize/__main__.py", line 469, in main
    ffmpeg_normalize.add_media_file(input_file, output_file)
  File "/home/m0nte-cr1st0/.virtualenvs/hypercube/lib/python3.8/site-packages/ffmpeg_normalize/_ffmpeg_normalize.py", line 164, in add_media_file
    mf = MediaFile(self, input_file, output_file)
  File "/home/m0nte-cr1st0/.virtualenvs/hypercube/lib/python3.8/site-packages/ffmpeg_normalize/_media_file.py", line 42, in __init__
    self.parse_streams()
  File "/home/m0nte-cr1st0/.virtualenvs/hypercube/lib/python3.8/site-packages/ffmpeg_normalize/_media_file.py", line 65, in parse_streams
    cmd_runner.run_command()
  File "/home/m0nte-cr1st0/.virtualenvs/hypercube/lib/python3.8/site-packages/ffmpeg_normalize/_cmd_utils.py", line 118, in run_command
    raise RuntimeError("Error running command {}: {}".format(self.cmd, str(stderr)))
RuntimeError: Error running command ['/usr/bin/ffmpeg', '-i', 'file.mp4', '-c', 'copy', '-t', '0', '-map', '0', '-f', 'null', '/dev/null']: ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x556651a78280] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x556651a78280] moov atom not found
file.mp4: Invalid data found when processing input
slhck commented 3 years ago

It seems your file is broken and cannot be read by ffmpeg.

What happens when you run the following?

ffmpeg -i file.mp4 out.mp4
dima-dmytruk23 commented 3 years ago

@slhck

ffmpeg -i file.mp4 out.mp4

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x562a08658240] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x562a08658240] moov atom not found
file.mp4: Invalid data found when processing input
slhck commented 3 years ago

Yeah, sorry, it seems the file itself is broken, not much that I can do here.

slhck commented 3 years ago

You could try using untrunc to fix the file.