Log in

View Full Version : Bash script to mass-convert HDV to x265


Aponia71
4th June 2026, 18:12
Hello everyone

I wrote a linux script to mass-convert dvgrab HDV rips to x265 videos.
It has been programmed in Arch Linux architecture (Manjaro), but it should work in Debian and Redhat/Fedora based distributions.
This is my first publication into a git repository, so be indulgent
If you are insterested in using or testing this script, please let me know.
Contributions to improve this script are welcome.

Some informations about it :

Convert your HDV video files (.m2t / .m2ts) to efficient x265 (HEVC) MKV files with AAC audio.
Optionally generate FFV1 lossless archival videos (with FLAC audio) and Opus audio tracks.
Designed for batch processing of camera‑captured HDV tapes.

The main purpose of this script is to get ride of interlaced material (real interlaced or progressive stored in interlaced format), as DV, HDV, MPEG2, MP2 are now obsolete.
We should be able to play our old movie camera recordings on modern hardware, and store them in lossless but deinterlaced archival format (ffv1).

My git repository is : hdv-to-x265
(https://codeberg.org/Aponia71/hdv-to-x265)
Thanks to all people who helped me to write this script with their internet contributions/articles/posts ...

Aponia71

microchip8
4th June 2026, 22:01
I have similar scripts that are designed to convert full-length feature films and series. Links in my signature

Z2697
5th June 2026, 17:45
# Converting HDV to x265 (progressive or interlaced)


I'm not sure what it means exactly, but I don't think using HEVC with interlaced content is a good idea.
There's no "integral" interlaced support (e.g. MBAFF) built into HEVC, expect poor quality (encoding with "weaved lines") or poor support (encoding as "field picture").

Z2697
6th June 2026, 08:38
FFMPEG_ARGS_OPTIONS_VIDEO_FFV1="-c:v ffv1 -g 1 -slices 16 -slicecrc 1 -context 1 -coder 2"


I've never touched "context" before, I tested it in one clip now, to me it just makes encoding and decoding slower with even worse compression.
(The "-g" option controls the context length, you are limiting it to minimum)

Aponia71
6th June 2026, 10:16
I've never touched "context" before, I tested it in one clip now, to me it just makes encoding and decoding slower with even worse compression.
(The "-g" option controls the context length, you are limiting it to minimum)

Hi Z2697,
which parameters do you recommend then for ffv1 ?

About " # Converting HDV to x265 (progressive or interlaced) "
==> I have some DV Tapes recorded in progressive (PF25 / PSF25 ?) , then without any deinterlace filter, and some tapes in classic interlaced TFF format, they will be deinterlaced with QTGMC filter, with basic parameters, they are enough for me.
I don't want or need other sharp / color / blur ... filter... just original pictures.

This is my first try to encode old DV tapes, so suggestions are welcome.
Thank you

Z2697
7th June 2026, 10:48
Hi Z2697,
which parameters do you recommend then for ffv1 ?

About
==> I have some DV Tapes recorded in progressive (PF25 / PSF25 ?) , then without any deinterlace filter, and some tapes in classic interlaced TFF format, they will be deinterlaced with QTGMC filter, with basic parameters, they are enough for me.
I don't want or need other sharp / color / blur ... filter... just original pictures.

This is my first try to encode old DV tapes, so suggestions are welcome.
Thank you

There aren't many options in ffv1, disable the "-context" option is enough.

As long as you are not encoding true interlaced content with x265 it's ok.
You might want to look around for some x265 parameters, for example disable sao for high quality targets.

Aponia71
7th June 2026, 17:10
Strange... according to https://www.ffv1.org/ and other document, -context only change output file size and compression ...
But I think you are right, -g 1 and -context 1 combination seems contradictory.
Altough output result is alway lossless...I will then correct this.

Thanks for your help