question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

time_mirror output appeared OSError when access time is negative

See original GitHub issue
if __name__=='__main__':
    clip = VideoFileClip(r"F:\video\WinBasedWorkHard_src.mp4", audio=True).fx(vfx.crop,0, 300, 540, 840)
    newclip = clip.fx(vfx.time_mirror)
    newclip.write_videofile(r"F:\video\WinBasedWorkHard_time_mirror.mp4", threads=8)

Expected Behavior

Output file success

Actual Behavior

Moviepy - Building video F:\video\WinBasedWorkHard_time_mirror.mp4.
MoviePy - Writing audio in WinBasedWorkHard_time_mirrorTEMP_MPY_wvf_snd.mp3
chunk:  98%|█████████▊| 1178/1208 [00:21<00:00, 49.13it/s, now=None]Traceback (most recent call last):
  File "F:/study/python/project/moviepyTest/moviepyTest.py", line 7, in <module>
    newclip.write_videofile(r"F:\video\WinBasedWorkHard_time_mirror.mp4", threads=8)
  File "<decorator-gen-61>", line 2, in write_videofile
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 56, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-60>", line 2, in write_videofile
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 135, in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
  File "<decorator-gen-59>", line 2, in write_videofile
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 24, in convert_masks_to_RGB
    return f(clip, *a, **k)
  File "<decorator-gen-58>", line 2, in write_videofile
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "C:\Program Files\Python37\lib\site-packages\moviepy\video\VideoClip.py", line 337, in write_videofile
    logger=logger,
  File "<decorator-gen-47>", line 2, in write_audiofile
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 56, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-46>", line 2, in write_audiofile
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "C:\Program Files\Python37\lib\site-packages\moviepy\audio\AudioClip.py", line 241, in write_audiofile
    logger=logger,
  File "<decorator-gen-9>", line 2, in ffmpeg_audiowrite
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 56, in requires_duration
    return f(clip, *a, **k)
  File "C:\Program Files\Python37\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 205, in ffmpeg_audiowrite
    chunksize=buffersize, quantize=True, nbytes=nbytes, fps=fps, logger=logger
  File "C:\Program Files\Python37\lib\site-packages\moviepy\audio\AudioClip.py", line 92, in iter_chunks
    tt, nbytes=nbytes, quantize=quantize, fps=fps, buffersize=chunksize
  File "<decorator-gen-44>", line 2, in to_soundarray
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 56, in requires_duration
    return f(clip, *a, **k)
  File "C:\Program Files\Python37\lib\site-packages\moviepy\audio\AudioClip.py", line 139, in to_soundarray
    snd_array = self.get_frame(tt)
  File "<decorator-gen-11>", line 2, in get_frame
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "C:\Program Files\Python37\lib\site-packages\moviepy\Clip.py", line 98, in get_frame
    return self.make_frame(t)
  File "C:\Program Files\Python37\lib\site-packages\moviepy\Clip.py", line 141, in <lambda>
    newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
  File "C:\Program Files\Python37\lib\site-packages\moviepy\Clip.py", line 193, in <lambda>
    lambda gf, t: gf(t_func(t)), apply_to, keep_duration=keep_duration
  File "<decorator-gen-11>", line 2, in get_frame
  File "C:\Program Files\Python37\lib\site-packages\moviepy\decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "C:\Program Files\Python37\lib\site-packages\moviepy\Clip.py", line 98, in get_frame
    return self.make_frame(t)
  File "C:\Program Files\Python37\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 82, in <lambda>
    self.make_frame = lambda t: self.reader.get_frame(t)
  File "C:\Program Files\Python37\lib\site-packages\moviepy\audio\io\readers.py", line 185, in get_frame
    + "with clip duration=%f seconds, " % self.duration
OSError: Error in file F:\video\WinBasedWorkHard_src.mp4, Accessing time t=-0.00--0.05 seconds, with clip duration=54.750000 seconds, 

Steps to Reproduce the Problem

1.Excute the scripts 2.When modify"clip = VideoFileClip(r"F:\video\WinBasedWorkHard_src.mp4", audio=True).fx(vfx.crop,0, 300, 540, 840)“to"clip = VideoFileClip(r"F:\video\WinBasedWorkHard_src.mp4”, audio=True).fx(vfx.crop,0, 300, 540, 840).subclip(0,3)",the last line of error message is “OSError: Error in file F:\video\WinBasedWorkHard_src.mp4, Accessing time t=-0.01–0.06 seconds, with clip duration=54.750000 seconds”,why duration=54.750000

I had searched history issues,but not found this error,perhaps is only appered in 2.0.0.dev1?

PS: Some my issues like 1246,1223,1249 ,Would you like to help me? WinBasedWorkHard_src.zip

Specifications

  • Python Version:3.72
  • Moviepy Version:2.0.0.dev1
  • Platform Name:windows
  • Platform Version:win7 64bits

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
tburrows13commented, Jan 11, 2021

@bertiebaggio Nice. Ideally you should use BitmapClip to show reproductions, because then it should be very easy to work out exactly which frame should go where. See the examples in tests/test_fx.py for how it gets used.

0reactions
bertiebaggiocommented, Jan 11, 2021

🚫 Yup, my mistake! When using latest master I have no repro. Apologies

Read more comments on GitHub >

github_iconTop Results From Across the Web

Untitled
Multi display port adapter, Chevrolet caravan diplomata, Uk 5 size chart, ... Sam choy hawaii, Tom harrell time's mirror, Mullanphy school, 456srs1, ...
Read more >
now unto him who is able - meg en dia betekenis
... nokia6600 software in pa sales share time mirror outside minute cut magix ... make me sick lyrics microsoft outlook web access hacking...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found