Comments (7)
That's quite strange. Seems like another mobile-video issue. What happens when you just ask ffmpeg to extract the frames? Command to do this:
ffmpeg -i my_video.webm %d.jpg
from scikit-video.
Two things happen:
- ffmpeg extracts 2881 frames out of a 3 second video. this must be a ffmpeg bug
- frames are not identical
On the other hand, in other cases where the number of frames extracted by ffmpeg matches the number of frames extracted by skvideo.io.vread
, (and when the number of frames is reasonable given the video duration) you can clearly infer motion from the skvideo.io
frames.
It appears that, in presence of this ffmpeg bug, skvideo.io does not know what to do and always extracts the same frame.
Also, I know it may be too much to ask, but would this be a possible workaround (not really a fix) when this happens: infer a frames per second rate and extract the frames accordingly in skvideo.io.vread
?
Example:: this video is a 3 sec video and has 2881 frames. Assuming 20 frames per second, there should be 60 frames. 2281 divided by 60 is 48, could skvideo.io extract every 48th frame (frames 48, 96, 144, 192, etc)?
Let me know if you would like me to email a sample video (the one where ffmpeg extracts 2881 frames in 3 secs).
from scikit-video.
Please do email a sample video. I'm sure there should be enough metadata in the video file that we just aren't parsing in scikit-video. As for the ffmpeg issue, I guess it's fetching an invalid framerate?
from scikit-video.
A sample program for reading,playing and writing the frames using skvideo and opencv
video = 'car.avi'
videogen = skvideo.io.vread(video)
videometadata = skvideo.io.ffprobe(video)
frame_rate = videometadata['video']['@avg_frame_rate']
num_frames = np.int(videometadata['video']['@nb_frames'])
print num_frames
for i in range(0,100): % I restricted to 100 as an example but if you wish to write all the frames of video change to for i in range(0,num_frames)
frame = cv2.cvtColor(videogen[i],cv2.COLOR_BGR2RGB) %this code do color conversion
cv2.imwrite("frame_"+str(i)+".jpg",frame)
cv2.imshow('frame',videogen[i])
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
Hope this might help someone.
from scikit-video.
Hi there. I see the issue has been closed but without a solution.
We are experiencing the same problem. Here is the case: we have a video recorded on an iPhone at a nominal rate of 120 FPS. The iPhone doesn't really keep up with it, so it records the video at 118 FPS.
Here is the output from ffprobe:
ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 7.2.0 (crosstool-NG 8a21ab48)
configuration: --prefix=/home/chiara/anaconda3/envs/mocap --disable-doc --enable-shared --extra-cflags='-fPIC -I/home/chiara/anaconda3/envs/mocap/include' --extra-cxxflags='=-fPIC' --extra-libs='-L/home/chiara/anaconda3/envs/mocap/lib -lz' --enable-pic --disable-static --disable-gpl --disable-nonfree --disable-openssl --enable-libvpx --cc=/home/chiara/anaconda3/envs/mocap/bin/x86_64-conda_cos6-linux-gnu-cc --cxx=/home/chiara/anaconda3/envs/mocap/bin/x86_64-conda_cos6-linux-gnu-c++ --enable-libopus
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_1967.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2018-05-08T04:29:42.000000Z
com.apple.quicktime.description: RAD:1506.666382:1506.666382:967.640320:515.699402:120.000000
Duration: 00:00:10.57, start: 0.000000, bitrate: 23360 kb/s
Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, progressive), 1920x1080, 22861 kb/s, 117.63 fps, 600 tbr, 600 tbn, 600 tbc (default)
Metadata:
creation_time : 2018-05-08T04:29:42.000000Z
handler_name : Core Media Data Handler
encoder : 'hvc1'
The problem that we experience is that the reported FPS is 600. Now, if we iterate through the frames, the iterator returns only the correct number of frames, but actually it returns 5 copies of the same frame and then stops at a fifth of the video.
I cannot upload the video here, but I can email it to whoever needs to handle this issue.
@beyondmetis can you reopen this, or would you like me to open a new issue?
Thanks
from scikit-video.
Let’s solve this. Please send the video to my email, [email protected]
from scikit-video.
Has this been solved? I still see the same problem with version scikit-video==1.1.11
from scikit-video.
Related Issues (20)
- output dict params
- measure/data is missing after installation from Git HOT 1
- Numpy warnings due to deprecated aliases HOT 4
- scipy version compatibility issue HOT 2
- How to encode video with FFmpegWriter so it is compatible with powerpoint 2016 HOT 1
- Typo in documentation: skvideo.io.write
- ffmpeg/ffprobe not found in path HOT 1
- Document inputdict and outputdict of FFmpegWriter HOT 1
- The extracted frames changed the colour of the video
- set fps in vwrite
- ValueError: No way to determine width or height from video. Need `-s` in `inputdict`. Consult documentation on I/O. HOT 2
- module 'skvideo' has no attribute 'io' HOT 1
- skvideo.io.ffprobe does not properly capture multiple streams; captures only the last stream of a '@codec_type'
- Load specific index (frame number) range HOT 5
- DeprecationWarning: tostring() is deprecated. Use tobytes() instead. HOT 1
- [Question] Add multiple metadata kv to file
- issue with reading video with variable frame rate
- FFmpegReader & FFmpegWriter no audio stream;
- Broken pipe errors in reader on enabled verbosity
- no sound in video output
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scikit-video.