Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg_reader.py:139: UserWarning: Warning: Using the last valid frame instead. #1233

Closed
mike592 opened this issue Jun 16, 2020 · 8 comments
Closed
Labels
bug Issues that report (apparent) bugs.

Comments

@mike592
Copy link

mike592 commented Jun 16, 2020

tburrows13 just committed new code a few minutes ago, and I just download it replaced my moviepy and run my program.

But write_videofile still gave out this warnning:

\moviepy\video\io\ffmpeg_reader.py:139: UserWarning: Warning: in file C:\AAF350.mp4, 1769472 bytes wanted but 0 bytes read,at frame 307/308, at time 10.23/10.26 sec. Using the last valid frame instead.

@mike592 mike592 added the bug Issues that report (apparent) bugs. label Jun 16, 2020
@tburrows13
Copy link
Collaborator

Do you mean that you used the version from GitHub, or simply the latest release on PyPI (installed with pip)?

For reference: #1220

@mike592
Copy link
Author

mike592 commented Jun 16, 2020

I use the version from Github, when I download it from Github, I see the time is 24 minutes after you committed.

@tburrows13
Copy link
Collaborator

tburrows13 commented Jun 16, 2020

Ok. Is the program actually failing, or just issuing a warning? If it is just the warning, you can probably ignore it and it should just duplicate the last ~2 frames of the video. Would you be able to link the video file here?

#1220 doesn't actually stop the warning from appearing, it just stops it crashing when it reaches the warning after skipping there from >100 frames before. It could be an issue with the wrong duration being detected by MoviePy (and so it then tries to read past the end of the file). This is an unresolved issue (see #1222).

If you can't send the video, please send the result of ffmpeg -i AAF350.mp4 -codec copy -f null -.

@mike592
Copy link
Author

mike592 commented Jun 16, 2020

I notice 1 thing, in your branch(name like xxxx fix read...errror), ffmpeg_reader.py there is a -acode -f null, but in master branch, there is no -acode

@tburrows13
Copy link
Collaborator

I'm not entirely sure what you mean:

https://github.com/tburrows13/moviepy/blob/fix-OSError-failed-to-read-first-frame/moviepy/video/io/ffmpeg_reader.py#L264
is the same as
https://github.com/Zulko/moviepy/blob/master/moviepy/video/io/ffmpeg_reader.py#L264

This was recently changed in #1063, possible incorrectly, hence why I am investigating it in #1222. You could try applying #1222 and seeing if that causes your videos to have a different (and correct) duration.

@mike592
Copy link
Author

mike592 commented Jun 16, 2020

I sent my test mp4 to your uk tom email address. Also I run ffmpeg and got this:

ffmpeg -i 111111111.mp4 -codec copy -f null -
=================================

ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200523
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  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
  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 '111111111.mp4':
  Metadata:
    minor_version   : 512
    major_brand     : isom
    compatible_brands: isomiso2avc1mp41
    information     : {"com.bytedance.info": "{}"}
    comment         : vid:v0200f970000brb4glubn5v3g13q5db0
    encoder         : Lavf58.20.100
  Duration: 00:00:10.26, start: 0.000000, bitrate: 743 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 576x1024 [SAR 1:1 DAR 9:16], 608 kb/s, 29.90 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, null, to 'pipe:':
  Metadata:
    minor_version   : 512
    major_brand     : isom
    compatible_brands: isomiso2avc1mp41
    information     : {"com.bytedance.info": "{}"}
    comment         : vid:v0200f970000brb4glubn5v3g13q5db0
    encoder         : Lavf58.29.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 576x1024 [SAR 1:1 DAR 9:16], q=2-31, 608 kb/s, 29.90 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  305 fps=0.0 q=-1.0 Lsize=N/A time=00:00:10.19 bitrate=N/A speed=5.11e+03x
video:758kB audio:160kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

@mike592
Copy link
Author

mike592 commented Jun 16, 2020

Sorry, I found that this line of code has been already committed from the branch to master

cmd = [FFMPEG_BINARY, "-i", filename, "-acodec", "copy", "-f", "null", "-"]

@tburrows13
Copy link
Collaborator

tburrows13 commented Jun 16, 2020

I've not tested with your mp4 but from that ffmpeg output, you can see that it says Duration: 00:00:10.26 which is what MoviePy will use, and time=00:00:10.19 which is what I think is the actual duration. So, it looks like #1222 will actually solve your problem. You'll have to give me a few days to confirm that #1222 doesn't break anything else, but I expect to merge it or something similar soon, and then publish a v2.0.0.dev2 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

No branches or pull requests

2 participants