FFmpeg and deinterlace #1606
-
Hello. Dear Mr Dave please tell me how to enable deinterlace in FFmpeg? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Short version: movie_extpipe Long Version; I'll be curious as to your results but as I understand it, the issue is likely with the capture rather than the encoding. Motion captures, processes and then re-encodes frames. The de-interlace option that previously existed only related to the encoding of movies. If that is the ONLY spot that the streaks are observed (not via the web interface, picture_output or getting false positives), then the movie_extpipe would allow you to add any encoding options desired. But.... I think that the real source of the problem is the capture. Motion captures frames and decodes them and treats what it gets as "everything" or "complete". It then compares that captured "full" image to a reference picture and if there are differences, it calls it motion, encodes that single image to a jpg or sends it off to be encoded into a movie. Whether the original image came from a interlace frame is not even a "thing" anymore when it gets sent to be encoded. Therefore, if the camera source is interlaced, every other frame (or whatever frequency exists) captured from the device is a partial frame. Since this is from the capture device, I would expect everything to be affected including the picture_output, motion detection as well as the web interface. So I think the real question should be "how do I get my camera source to be de-interlaced as it is sent into Motion". For this, I'd suggest using the netcam_url and v4l2 variant. When the regular video_device option is used, Motion simply pulls the bytes from the device buffer. If the netcam_url with the v4l2 variant is used, then that gets processed via FFmpeg and with the new netcam_params option, any FFmpeg option desired can be added. Finally, I'll caveat the above with.......I do not have one of these capture cards any longer. This is just my understanding of the interlace process on devices and I could be entirely off base. |
Beta Was this translation helpful? Give feedback.
-
I turned out to be a donkey, I was inattentive, forgive me... Where: David, thanks for the support, now everything works as it should! Sorry again for being such a donkey. Topic can be marked as solved! |
Beta Was this translation helpful? Give feedback.
I turned out to be a donkey, I was inattentive, forgive me...
I carefully re-read the documentation and realized that movie_extpipe is just the solution to my problem.
After studying ffmpeg a little, I came up with this config:
First, turn off movie_output
movie_output off
movie_output_motion off
#movie_quality 0
#movie_bps 800000
#movie_codec mkv
Then turn on
movie_extpipe_use on
movie_extpipe ffmpeg -v error -stats -y -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %fps -i pipe:0 -c:v libx265 -crf 21 -x265-params log-level=error -preset ultrafast -vf yadif=2 -f matroska %f.mkv
Where:
-vf yadif=2, filter and filter type, I had timestamp distortion with yadif=1, so yadif=2, but …