fastapi-video icon indicating copy to clipboard operation
fastapi-video copied to clipboard

It doesn't work when the video is cut from an origin mp4 by ffmpeg

Open Honghe opened this issue 3 years ago • 6 comments

Environment:

  • Ubuntu 20.04
  • Chrome Version 89.0.4389.114 (Official Build) (64-bit)

It doesn't work when video is cut from an origin mp4 by ffmpeg, the origin mp4 is OK, e.g.:

ffmpeg -i origin.mp4 -ss 0 -t 30 out.mp4

or

ffmpeg -i origin.mp4 -ss 0 -t 30 -c copy out.mp4

The Partial Content responce is odd(the start,end lines), they are not continuous:

INFO:     Application startup complete.
INFO:     127.0.0.1:45878 - "GET / HTTP/1.1" 200 OK
start,end: 0,1048576
INFO:     127.0.0.1:45878 - "GET /video HTTP/1.1" 206 Partial Content
start,end: 1966080,3014656
INFO:     127.0.0.1:45882 - "GET /video HTTP/1.1" 206 Partial Content

image

The origin mp4 information, which downloaded from https://www.youtube.com/watch?v=QW7r9i-nfpw

$ ffprobe "Automatic Speech Recognition _ by Darragh Hanley _ Kaggle Days Dubai _ Kaggle.mp4"
ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Automatic Speech Recognition _ by Darragh Hanley _ Kaggle Days Dubai _ Kaggle.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2019-08-02T00:11:56.000000Z
  Duration: 00:39:46.43, start: 0.000000, bitrate: 580 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 449 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      creation_time   : 2019-08-02T00:11:56.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 08/01/2019.
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2019-08-02T00:11:56.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 08/01/2019.

Honghe avatar Apr 13 '21 02:04 Honghe

Update:

The reason is the location of moov atom of mp4, and FireFox can handle it.

Chrome FireFox
Origin MP4 OK OK
A slice video cut from origin MP4 Not Work OK

Honghe avatar Apr 14 '21 03:04 Honghe

Hi Honghe, I am not a video expert and I am not sure if I can help you somehow with this problem.

stribny avatar Apr 14 '21 07:04 stribny

Hey!, @Honghe did you ever find a solution?

muqshots avatar Jul 21 '21 11:07 muqshots

@muqshots Don't use -c copy in ffmpeg.

Honghe avatar Jul 21 '21 14:07 Honghe

@Honghe did you find a solution to use it with files that are already altered? Since i can't really revert a conversion or mass convert as that will take a while.

Razorback360 avatar Jul 22 '21 07:07 Razorback360

Is this thread still open? Did anyone find any answer? Facing the same issue. The MOOV atom is located at the middle because of some video compression algorithm. Firefox handles it, but Chrome is unable to handle the video. It's in a simple tag.

sauravjmedhi-softsensor avatar Aug 09 '23 08:08 sauravjmedhi-softsensor