Comments (11)
Until today we don't have a simple documentation for outputdict from FFmpegWriter. Is one of the most important things on this lib. How can I define how to write an video? Nowhere with explanations? A single example?
from scikit-video.
Ah good catch. I will have to update the documentation about FFmpegWriter. I'm in the process of writing more example-based documentation. You can see the current progress (with dict examples for I/O) here:
http://www.scikit-video.org/dev/examples.html
from scikit-video.
Hey guys. Check this code :
from skvideo.io import VideoWriter
import numpy
writer = VideoWriter(filename, frameSize=(w, h))
writer.open()
while True:
.......
writer.write("some random video frame- from iteration process")
.......
writer.release()
It does output a video file, however the quality of it is very poor beyond the first keyframe. Your skvideo documentation states that FFmpegWriter should be used for more customisation of parameters, however that does not exist.
http://www.scikit-video.org/dev/examples.html this link does not provide an example of video file written to disk frame by frame.
What's wrong with this thread? Why is there such bad quality of output? Why is there such bad quality of documentation?
Why is there no proper way to write video in Python, in 2016? :)
from scikit-video.
Ah! I did forget to add an example on the webpage regarding high-quality h264 encodes.
If you want to output a good quality video (frame by frame), you can start from the below example which uses the libx264 codec with bitrate set to 30MBps which encodes random noise:
import skvideo.io
import skvideo.measure
import numpy as np
outputfile = "test.mp4"
outputdata = np.random.random(size=(30, 480, 640, 3)) * 255
outputdata = outputdata.astype(np.uint8)
# start the FFmpeg writing subprocess with following parameters
writer = skvideo.io.FFmpegWriter(outputfile, outputdict={
'-vcodec': 'libx264', '-b': '30000000'
})
for i in range(30):
writer.writeFrame(outputdata[i])
writer.close()
inputdata = skvideo.io.vread(outputfile)
# test each frame's SSIM score
mSSIM = 0
for i in range(30):
mSSIM += skvideo.measure.ssim(np.mean(inputdata[i], axis=2), np.mean(outputdata[i], axis=2))
mSSIM /= 30.0
print mSSIM
You can play with the coding parameters and see how it is reflected in the measured mean SSIM value. BTW, the flags in the outputdict are passed directly to FFmpeg through the CLI.
Perhaps there is a better, more generic way to write high quality video as h264, rather than explicitly using a dictionary of parameters. I think the current approach is flexible although currently poorly documented.
from scikit-video.
I have now added this to the dev branch of the website
from scikit-video.
It would be awesome if you could state somewhere whether it's possible to grab frames from a webcam? Have not been able to find any documentation on that in the latest release, and had no luck with ffmpegreader so far..
from scikit-video.
from scikit-video.
Hi,
Thanks for the nice package!
I am working with skvideo and trying to output a video but while the code above (high quality video) runs and produces a video file, the created video is not being able to be read by Window media player/ seems to not have any frames. Do you know what is causing the problem and how could I fix this?
from scikit-video.
Is the file size larger than 0? You can try playing it with VLC
from scikit-video.
Hi, I downloaded VLC and it works perfectly! Thank you.
from scikit-video.
Examples: http://www.scikit-video.org/stable/examples.html
If you want to go beyond this, you can check out the documentation for ffmpeg's output flags.
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.