amiaopensource / vrecord

Vrecord is open-source software for capturing a video signal and turning it into a digital file.
https://github.com/amiaopensource/vrecord
149 stars 44 forks source link

vrecord pipe error with DVCPRO ERR=141 #766

Open bravoalphatango opened 8 months ago

bravoalphatango commented 8 months ago

Hi There,

I am running into an issue with vrecord trying to transfer some DVCPRO tapes. I am using a MacBook Pro with an M1 chip that is running on Monterey 12.6.5. The deck being used is a DVCPRO AJ-D250. I have swapped out cables and other decks of the same model but keep getting an error right when the recording begins.

avftl seems to be working, but I think there may be an issue with FFmpeg. I did notice that the version of FFmpeg I have installed on my computer is v6. However, vrecord (version 2023-08-07) seems to be utilizing FFmpeg version 5.1.2. Not sure if this is contributing to what is going on.

$ vrecord -e                                                                                         
And place logs at /Users/tothba/Desktop too.
Summary: Copying video from [0] DVCPro. Technician=Brianna Toth. Inputs recorded to /Users/tothba/Desktop/test.dv and Auxiliary Files created in /Users/tothba/Desktop. 
Hit enter to start recording

Close the playback window to stop recording.
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpegdecklink/5.1.2 --disable-shared --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libfontconfig --disable-libjack --disable-indev=jack --enable-neon --enable-nonfree --enable-decklink --extra-cflags=-I/opt/homebrew/include --extra-ldflags=-L/opt/homebrew/include
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
pipe:: Invalid data found when processing inputKB sq=    0B f=0/0   
pipe:: Invalid data found when processing input
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
 2023-10-25T13:30:36 - vrecord exited a form in an unexpected way (P1_ERR=141), please report this error to https://github.com/amiaopensource/vrecord/issues
 2023-10-25T13:30:36 - Error details: avfctl
$ cat Desktop/test_capture_options.log                                    
computer_name: SLA-LCG-3117B
computer_model_name: MacBook Pro
computer_model_id: MacBookPro18,1
computer_processor_name: 
computer_processor_speed: 
computer_processor_count: 
computer_memory: 32 GB
computer_serial: TR2L9N9FJK
computer_cores: 10
user_name: tothba
operating_system_VERSION: Darwin Kernel Version 21.6.0: Thu Mar  9 20:12:21 PST 2023; root:xnu-8020.240.18.700.8~1/RELEASE_ARM64_T6000
vrecord version: 2023-08-07
datetime_start: 2023-10-25T13:29:20
capture_device_node: /dev/disk3
capture_device_protocol: Apple Fabric
capture_device_name: APPLE SSD AP1024R
capture_device_block_size: 4096 Bytes
capture_device_location: Internal
capture_device_partition_type: 41504653-0000-11AA-AA11-00306543ECAC
capture_device_partition_name: APFS
capture_device_volume_uuid: 8984BC4A-68B9-4C50-BF71-5E73838E7548
capture_device_volume_available: 
capture_device_volume_total: 
FILE_PATH: /Users/tothba/Desktop/test.dv
AVFCTL_INPUT_CHOICE: [0] DVCPro
WAVEFORM_SCALE_CHOICE: digital
SIGNAL_VIEW_CHOICE: Broadcast Range
MONITOR_AUDIO_CHOICE: Yes
PLAYBACKVIEW_CHOICE: Visual + Numerical
DV_CONTAINER_CHOICE: DV

TECHNICIAN: Brianna Toth
Capture command: avfctl -device 0 -cmd capture -
Record command: /opt/homebrew/opt/ffmpegdecklink/bin/ffmpeg-dl -nostdin -nostats -i - -map 0:v -c copy -f rawvideo /Users/tothba/Desktop/test.dv -map 0:v -f rawvideo -c copy -
Playback command: /opt/homebrew/opt/ffmpegdecklink/bin/ffplay-dl -v info -hide_banner -stats -autoexit -window_title mode:record - input:'[0] DVCPro' - to end recording press q, esc, or close video window -i - -af channelmap=0|1:stereo
Capture exit code: 141
Record exit code: 1
Playback exit code: 0
vrecord command Error: invalid P1_ERR value of 141
computer_name: SLA-LCG-3117B
computer_model_name: MacBook Pro
computer_model_id: MacBookPro18,1
computer_processor_name: 
computer_processor_speed: 
computer_processor_count: 
computer_memory: 32 GB
computer_serial: TR2L9N9FJK
computer_cores: 10
user_name: tothba
operating_system_VERSION: Darwin Kernel Version 21.6.0: Thu Mar  9 20:12:21 PST 2023; root:xnu-8020.240.18.700.8~1/RELEASE_ARM64_T6000
vrecord version: 2023-08-07
datetime_start: 2023-10-25T13:30:34
capture_device_node: /dev/disk3
capture_device_protocol: Apple Fabric
capture_device_name: APPLE SSD AP1024R
capture_device_block_size: 4096 Bytes
capture_device_location: Internal
capture_device_partition_type: 41504653-0000-11AA-AA11-00306543ECAC
capture_device_partition_name: APFS
capture_device_volume_uuid: 8984BC4A-68B9-4C50-BF71-5E73838E7548
capture_device_volume_available: 
capture_device_volume_total: 
FILE_PATH: /Users/tothba/Desktop/test.dv
AVFCTL_INPUT_CHOICE: [0] DVCPro
WAVEFORM_SCALE_CHOICE: digital
SIGNAL_VIEW_CHOICE: Broadcast Range
MONITOR_AUDIO_CHOICE: Yes
PLAYBACKVIEW_CHOICE: Visual + Numerical
DV_CONTAINER_CHOICE: DV

TECHNICIAN: Brianna Toth
Capture command: avfctl -device 0 -cmd capture -
Record command: /opt/homebrew/opt/ffmpegdecklink/bin/ffmpeg-dl -nostdin -nostats -i - -map 0:v -c copy -f rawvideo /Users/tothba/Desktop/test.dv -map 0:v -f rawvideo -c copy -
Playback command: /opt/homebrew/opt/ffmpegdecklink/bin/ffplay-dl -v info -hide_banner -stats -autoexit -window_title mode:record - input:'[0] DVCPro' - to end recording press q, esc, or close video window -i - -af channelmap=0|1:stereo
Capture exit code: 141
Record exit code: 1
Playback exit code: 0
vrecord command Error: invalid P1_ERR value of 141
bravoalphatango commented 8 months ago

I should also mention that this issue is not happening with any of our miniDV decks, just DVCPRO.

privatezero commented 8 months ago

Hi @bravoalphatango, if you run the raw capture command that is displayed in the log does it still error? vfctl -device 0 -cmd capture - | /opt/homebrew/opt/ffmpegdecklink/bin/ffmpeg-dl -nostdin -nostats -i - -map 0:v -c copy -f rawvideo ~/Desktop/test.dv

cajunjoel commented 6 months ago

Helping BAT. The error we get from your suggested command is: pipe:: Invalid data found when processing input

If we do the following (separating the input/output)

avfctl -device 0 -cmd capture my-raw-data
(let it run for a whilte, then ctrl-c)
/opt/homebrew/opt/ffmpegdecklink/bin/ffmpeg-dl -nostdin -nostats -i my-raw-data -map 0:v -c copy -f rawvideo ~/Desktop/test.dv

We get the same error: pipe:: Invalid data found when processing input

If we rename the file mv my-raw-data my-raw-data.dv and then do the ffmpeg command with the new filename: /opt/homebrew/opt/ffmpegdecklink/bin/ffmpeg-dl -nostdin -nostats -i my-raw-data.dv -map 0:v -c copy -f rawvideo ~/Desktop/test.dv

we get the following:

[dv @ 0x13de04d50] Format dv detected only with low score of 1, misdetection possible!
[dv @ 0x13de04d50] Cannot find DV header.
my-raw-data.dv: Invalid data found when processing input

I suppose the situation is that the data coming from avfctl is not a format known or expected by ffmpeg-dl. And it doesn't seem to be DV data. Is it supposed to be?

privatezero commented 6 months ago

Interesting! It does look like the issue is with the data avfctl is capturing. @dericed has a pull request at https://github.com/amiaopensource/vrecord/pull/770 that hasn't been merged yet that actually replaces avfctl with dvrescue within vrecord. It might be worth testing the version of vrecord in his branch to see if that helped with your problem.

A quick way to see if that might be a viable fix for you would be to test capturing your tape via the dvrescue cli and seeing if it gives you a valid file that ffmpeg can work with.

cajunjoel commented 6 months ago

We did grab the branch and tried allover and it seemed to be better. The output from ~/bin/vrecord-updates-on-handling-recorders/vrecord -x didn't quite behave becuase the ffplay window didn't appear, the terminal output was:

Starting the vrecord GUI. To bypass the GUI, run like 'vrecord FILENAME'.

And place logs at /Users/tothba/bin too.
Summary: Copying video from DVCPro. Technician=B Toth. Inputs recorded to /Users/tothba/bin/NewTest.dv and Auxiliary Files created in /Users/tothba/bin. 
Hit enter to start recording
Close the playback window to stop recording.
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpegdecklink/5.1.2 --disable-shared --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libfontconfig --disable-libjack --disable-indev=jack --enable-neon --enable-nonfree --enable-decklink --extra-cflags=-I/opt/homebrew/include --extra-ldflags=-L/opt/homebrew/include
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
DVRescue v.0.22.10 (MediaInfoLib v.22.09) by MIPoPSq=    0B f=0/0   
^C 2023-12-21T14:26:23 - vrecord exited a form in an unexpected way (P1_ERR=130), please report this error to https://github.com/amiaopensource/vrecord/issues
 2023-12-21T14:26:23 - Error details: dvrescue

One thing of note here is that the last line of the output during the run would flicker (for lack of a better term) and I would see "nan" appear, which often indicates problems.. And clearly Zero Bytes and Zero Frames indicates something amiss.

The log file contains the following

computer_name: SLA-LCG-3117B
computer_model_name: MacBook Pro
computer_model_id: MacBookPro18,1
computer_processor_name: 
computer_processor_speed: 
computer_processor_count: 
computer_memory: 32 GB
computer_serial: TR2L9N9FJK
computer_cores: 10
user_name: tothba
operating_system_VERSION: Darwin Kernel Version 21.6.0: Thu Mar  9 20:12:21 PST 2023; root:xnu-8020.240.18.700.8~1/RELEASE_ARM64_T6000
vrecord version: 2023-08-07
datetime_start: 2023-12-21T14:25:54
capture_device_node: /dev/disk3
capture_device_protocol: Apple Fabric
capture_device_name: APPLE SSD AP1024R
capture_device_block_size: 4096 Bytes
capture_device_location: Internal
capture_device_partition_type: 41504653-0000-11AA-AA11-00306543ECAC
capture_device_partition_name: APFS
capture_device_volume_uuid: 8984BC4A-68B9-4C50-BF71-5E73838E7548
capture_device_volume_available: 
capture_device_volume_total: 
FILE_PATH: /Users/tothba/bin/NewTest.dv
DVRESCUE_INPUT_CHOICE: DVCPro
WAVEFORM_SCALE_CHOICE: digital
SIGNAL_VIEW_CHOICE: Broadcast Range
SIGNAL_INT_CHOICE: auto
MONITOR_AUDIO_CHOICE: Yes
PLAYBACKVIEW_CHOICE: Visual + Numerical
DV_CONTAINER_CHOICE: DV

TECHNICIAN: B Toth
Capture command: dvrescue device://DVCPro --capture -m -
Record command: /opt/homebrew/opt/ffmpegdecklink/bin/ffmpeg-dl -nostdin -nostats -i - -map 0:v -c copy -f rawvideo /Users/tothba/bin/NewTest.dv -map 0:v -f rawvideo -c copy -
Playback command: /opt/homebrew/opt/ffmpegdecklink/bin/ffplay-dl -v info -hide_banner -stats -autoexit -window_title mode:record - input:'DVCPro' - to end recording press q, esc, or close video window -i - -af channelmap=0|1:stereo
Capture exit code: 130
Record exit code: 1
Playback exit code: 123
vrecord command Error: invalid P1_ERR value of 130

Breaking the commands down, using dvrescue device://DVCPro --capture -m - we can't get any output. Presumably we can redirect the output of this command to a file using dvrescue device://DVCPro --capture -m - > filename.blah but the filename.blah file is always zero bytes. However, we do get an increasing time signature (i.e. 1795 01:02:21;19 (1.0x, DV 120)) as if dvrescue is successful at communicating with the deck, but there's still no actual output.

I'm beginning to believe this is a problem with the deck and the cables and the fact that we're trying to jerry-rig a FireWire 400 cable to a USB-C using two adapters. Probably not ideal, yes?

libbyhopfauf commented 5 months ago

I'm beginning to believe this is a problem with the deck and the cables and the fact that we're trying to jerry-rig a FireWire 400 cable to a USB-C using two adapters. Probably not ideal, yes?

@cajunjoel That's not an uncommon setup and is the same daisy chain I am using to capture from a deck using vrecord or dvrescue. There is a chance that there might be an issue with the cables, but if there was, the deck usually doesn't appear. You could definitely try testing with different adapters and cables, swapping out one at a time to see if that fixes it.

The issue both you and @bravoalphatango are having sounds similar to this issue I was having with dvrescue previously, not capturing DVCPRO. But at the time, vrecord was. Have both of you checked the security policy of your computers in recovery mode to see if they need to be reset? I keep having to do this on my M1 Macbook Pro (seems like they get reset every so often). Might not be a factor, but just to rule it out :)

Testing out again on my end with @privatezero's changes to see if it works.

libbyhopfauf commented 5 months ago

Have both of you checked the security policy of your computers in recovery mode to see if they need to be reset? I keep having to do this on my M1 Macbook Pro (seems like they get reset every so often). Might not be a factor, but just to rule it out :)

@cajunjoel @bravoalphatango Never mind on this bit! I see that you said that it was only an issue with DVCPRO vs. other DV formats.

libbyhopfauf commented 5 months ago

@cajunjoel @bravoalphatango would you two mind downloading/installing the latest release of DVRescue and see if you can capture in there? The hope is that the new release has corrected these issues and can be rolled into vrecord for dvcapture.

I will note that I've found the deck control to still be a little buggy for FF/REW, but capture is consistently working on multiple computers at the MIPoPS office and I'm just curious if the release fixes the issues that you two were having.

Let me know how it goes!