[FFmpeg-user] Capture HDV and S-Video from tape via HDMI-USB to 422 FFV1

Terje J. Hanssen terjejhanssen at gmail.com
Fri Feb 17 23:22:25 EET 2023


Hi Dave


Den 17.02.2023 18:47, skrev Dave Rice:
> Hi Terje,
>
>> On Feb 17, 2023, at 11:52 AM, Terje J. Hanssen<terjejhanssen at gmail.com>  wrote:
>>
>> I ask here for ffmpeg feedback on two capture setups from video tape playback to 422 ffv1.mkv in realtime.
>>
>> Setup 1) HDV playback/HDMI out -> HDMI-USB3/ms2130 capture -> ffmpeg/v4l2 -> 422 FHD FFV1/MKV
>>
>> According to S.Mullen's handbook for the camcorder (FX7E here):
>>
>>    According to Sony, the EIP works at 1920x1080 in a 4:2:2 colorspace.
>>    V1 and FX7 provide an HDMI output port that carries uncompressed
>>    4:2:2, 8-bit, digital video plus dual-channel PCM, 16-bit, 48kHz
>>    audio. If you are playing a 1080i50 HDV tape: the 4:2:0 MPEG-2 is
>>    decoded and chroma up-scaled to a 4:2:2. The HDMI chip downscales
>>    1440 to 1280 while it up-scales 540 to 720. The result is 720p50
>>    output via HDMI.
>>
>>
>> A preliminary test with FX7 camera (not HDV 1080i/MP2 tape playback) and another ms2109 capture card, supported 422 FHD 1920x1080p at just 5 fps using this command line:
>>
>>    ffmpeg -hide_banner -f alsa -ac 2 -i hw:CARD=MS2109,DEV=0 -f v4l2
>>    -framerate 25 -video_size 1920x1080 -i /dev/video0 -codec:v ffv1
>>    -level 3 -codec:a pcm_s16le -f matroska video-out_ffv1.mkv
> Have you considered avoiding HDMI? Here you’re changing the resolution and colorspace and audio compression characteristics to include HDMI in the middle of the process. If you have a firewire cable you could transfer the m2ts stream from the tape into ffmpeg as use a stream copy rather than a realtime encoding.

Actually my plan was to first transfer the hdv.m2t files from tape 
playback via firewire to a stand-alone Datavideo DN-300 DV & HDV HDD 
recorder, which I've used a lot previously to digitize analog S-video 
and record as DV files. Afterwards I mounted DN-300 via firewire to my 
Linux workstation.
But unhappily, ten years old and unsupported hardware seems to just die, 
and DN-300 doesn't longer initialize or recognize its HDD during power on.

Currently my HDV camcorder is on service, so I ask: Is it possible to 
transfer/grab HDV files via Firewire to ffmpeg? (I have already
libiec61883, libraw1394, libavc1394 installed on my Leap). If so, a 
command example or guide to start with would be welcome.


So to HDMI. My preliminar test above was using the camera EIP only, so 
possibly there was no video change just in this case. I think I read 
somewhere that the camcorder/hardware that compressed and downscaled a 
video for storage (here to mpeg-2 hdv on dv tape), probably would do the 
best job back again, typical from 4:2:0 to 4:2:2 color subsampling.

The HDMI-USB ms2130 capture card (ordered) should according to its specs 
support YUY2, which seems to be 8-bit 422 color precision.
At least for S-video conversion and capture to DV with 4:2:0 color 
subsampling, this HDMI way hopefully can give give som better color 
reproduction.
The S-video to HDMI converter unhappily has no definitiv specification.
In general my impression have always been that DV playback has some 
lesser (darker) colors than the corresponding source S-video tape playback.


>> Setup 2) PAL S-video playback -> TBC -> ADC/HDMI adapter -> HDMI-USB3/ms2130 capture -> ffmpeg/v4l2 -> 422 FFV1/MKV
>>
>> The PAL S-video/AFM HiFi playback can be
>>
>> * Hi8 tape playback/S-video out from a Sony TR2000E camcorder or a
>>    S880E Hi8 deck
>> * S-VHS playback from a Panasonic NV-HS1000 S-VHS deck
>>
>>
>> A preliminary, fictive test trying the FX7 camera to HDMI instead, managed 422 video at 720x576 and 25 fps using this command line
>>
>>    ffmpeg -hide_banner -f alsa -ac 2 -i hw:CARD=MS2109,DEV=0 -f v4l2
>>    -framerate 25 -video_size 720x576 -i /dev/video0 -codec:v ffv1
>>    -level 3 -codec:a pcm_s16le -f matroska video-out_ffv1.mkv
>>
>>
>> I am somewhat unsure if the above are optimal ffmpeg codes and should like to get clarified what input/output format definitions (standards PAL, resolution, colors, framerates etc) that are neccesary and recommended, when here are both a source tape playback device and video out via HDMI and ADC or HDMI-USB card?
> I’d suggest adding more of the audiovisual characteristics if your input isn’t providing them.

How do I possibly know or verify if the input does or doesn't provide 
these caracteristics?
Does ffmpeg/v4l2 recognize the camcorder player output, or just read 
from the ADC and/or the HDMI-USB3 capture card?
> For instance, for an S-video PAL source I think you could add:
>
> -color_range mpeg

Possibly I misunderstand something here, but why "mpeg" color_range?

> -color_primaries bt470bg
> -color_trc bt709
> -colorspace bt470bg
>
> If ffmpeg interprets the input as non-interlaced when it is, you could add:
> -vf setfield=tff
>
> Also if ffmpeg interprets the input without an aspect ratio you may want to set it, else you’ll get a 1/1 SAR with your command.
>
>> Earlier playback has showed a bit flickering at the top and bottom horizontal line of the S-video 720x576. Possibly these can be cropped away with ffmpeg crop filter, or optional map or crop the whole 4:3 video image to 16:9. Suggestions?

I wonder if filter map and crop does the same, that is cut off top and 
bottom of a 4:3 SD image to make it 16:9 wide SD, which can be upscaled 
to fullscreen during playback on typical a 16:9 HDTV?

I thought to apply a command like this (Pad 4:3 into 16:9) which is 
aimed to "Transform a video file with 4:3 aspect ratio into a video file 
with 16:9 aspect ration by correct pillar-boxing": 
https://avpres.net/FFmpeg/4-3_16-9

     ffmpeg \
         -i input_file \
         -filter:v "pad=ih*16/9:ih:(ow-iw)/2:(oh-ih)/2" \
         -c:a copy \
         output_file

> That may just be head switching from the original videotape. You may be able to control that with tracking or head alignment in the unit if that’s adjustable.

Yes, I know it happened after a camcorder service, and the Hi8 deck is 
also another but better player than recorded on.
By the way, I don't take the risk now to adjust the head.

> Otherwise if you’re using Matroska you could consider using the PixelCrop* elements to store the intended display aperture for the video, while still storing the entire frame.
> Dave

Thank you for good advices !

Terje

>
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org  with subject "unsubscribe".
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org  with subject "unsubscribe".


More information about the ffmpeg-user mailing list