mipops / dvrescue

Archivist-made software that supports data migration from DV tapes into digital files suitable for long-term preservation. Snapshot daily builds are at https://mediaarea.net/download/snapshots/binary/dvrescue/.
BSD 3-Clause "New" or "Revised" License
93 stars 20 forks source link

issue packaging unusual audio configuration w/ -f flag #704

Closed bturkus closed 9 months ago

bturkus commented 1 year ago

Hi,

Using the most recent proper release of dvrescue, and also the latest macOS daily build that I could find, I've been having some issues packaging DV files with unusual audio configurations (these files in particular switch from 2 CH/48 to 4 CH/32 and then back to 2CH/48; essentially opening and closing title/credit sequences that surround program content).

What I'm finding is that the files package properly when using dvpackager without the -f flag (the resulting files represent all three sections combined), but when invoking -f, the only resulting files are the 2CH/48 opening credit sequences.

Attaching the dvrescue xml for reference, and including the verbose terminal output, but I was curious to know:

I also tried using the various Audio Resample options, but that didn't seem to help.

Thanks!

Ben

benjaminturkus@MY-DIGCS-056430 ~ % dvpackager -e mkv -f -v /Volumes/FD_SSD_05/mkv/myd_723175_v01_pm.mkv 
#CONDENSE_OPTS is set to -s
#Using /usr/local/opt/ffmpegdecklink/bin/ffmpeg-dl for ffmpeg operations.
Packaging myd_723175_v01_pm.mkv, making dvrescue outputs
#No xmlstarlet error                  
#Trying to move the temporary xml from /var/folders/fy/ftghrk557c7b9n4g6lw19z640000gp/T/dvpackager.XXXXXX.cZA9fIdX to /Volumes/FD_SSD_05/mkv/myd_723175_v01_pm.mkv.dvrescue.xml
#DV_FRAME_COUNT=(156222)
#SOURCE_FORMAT=(DV)
#Trying to present a table of ranges

# Segmentation options. Split on: Recording_Start_Marker = 0, Recording_Timestamp_Jump = 0, Timecode_Jump = 0, Audio_characteristics_change = 0, Aspect_Ratio_change = 1
#         St='Flagged Start of a recording', ncTC='non-continuous timecode value', ncR='non-continuous recording timestamp value'
  # | PTS Range                         | Duration | Frame Range         | Byte Range                | Timecode    | Recording Timestamp    | Size      | Frame Rate | DAR   | ChSub | Audio     | St | ncTC | ncR |
  1 | 00:00:00.000000 - 01:26:52.607400 | 5212.607 |        0 -   156221 |           0 -   319680000 | 00:00:05:00 |                        |   720x480 | 30000/1001 |   4/3 | 4:1:1 | 2ch 48000 |    |      |     |

The results will be written to /Volumes/FD_SSD_05/mkv
### Packaging started: /Volumes/FD_SSD_05/mkv/myd_723175_v01_pm_part1.mkv
#Reading from DV stream input at byte range 0-319680000
#The audio range sublist (from frame 0 to 156221) is
#00:00:00.000000|01:26:52.607400|0|156221|00:00:05:00|0||720x480|30000/1001|4:1:1|4/3|48000|2||||0|319680000|18746520000
#Prepping a mapping for 2 channel input ().
#Writing a chapter track at /var/folders/fy/ftghrk557c7b9n4g6lw19z640000gp/T/dvpackager.XXXXXX.29IVUWjB.ffmetadata.
#Found 1 point(s) for chapter marks.
#Skipping the process to embed chapters since there would only be one.
#Trying to run: /usr/local/opt/ffmpegdecklink/bin/ffmpeg-dl  -y -nostdin -hide_banner -i subfile,,start,0,end,319680000,,:/Volumes/FD_SSD_05/mkv/myd_723175_v01_pm.mkv    -filter_complex [0:a:0]aresample=async=1:min_hard_comp=0.01[aud] -t 5212.607400000 -c:a pcm_s16le -c:v:0 copy -f matroska -map 0:v:0 -map [aud] -metadata timecode=00:00:05:00 -aspect 4/3 /Volumes/FD_SSD_05/mkv/myd_723175_v01_pm_part1.mkv
[dv @ 0x7ff15a404100] Detected timecode is invalid
[dv @ 0x7ff15a404100] Estimating duration from bitrate, this may be inaccurate
Input #0, dv, from 'subfile,,start,0,end,319680000,,:/Volumes/FD_SSD_05/mkv/myd_723175_v01_pm.mkv':
  Duration: 00:01:28.89, start: 0.000000, bitrate: 28771 kb/s
  Stream #0:0: Video: dvvideo, yuv411p, 720x480 [SAR 8:9 DAR 4:3], 25000 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Overriding aspect ratio with stream copy may produce invalid files
Stream mapping:
  Stream #0:1 (pcm_s16le) -> aresample:default
  Stream #0:0 -> #0:0 (copy)
  aresample:default -> Stream #0:1 (pcm_s16le)
Output #0, matroska, to '/Volumes/FD_SSD_05/mkv/myd_723175_v01_pm_part1.mkv':
  Metadata:
    timecode        : 00:00:05:00
    encoder         : Lavf59.27.100
  Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv411p, 720x480 [SAR 8:9 DAR 4:3], q=2-31, 25000 kb/s, 29.97 fps, 29.97 tbr, 1k tbn
  Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc59.37.100 pcm_s16le
frame= 2664 fps=0.0 q=-1.0 Lsize=  328994kB time=00:01:28.88 bitrate=30320.0kbits/s speed= 159x     
video:312188kB audio:16667kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.042522%
#AUD_STREAM_COUNT=(2)
#VID_DUR=(88888.000000), AUD_DIR=(88888.000000), DUR_DIFF=(0.000000)
#DUR_DIFF is within an acceptable range.
ERROR: myd_723175_v01_pm.mkv contained 156222 DV frames at 00:00:00.000000-01:26:52.607400 but myd_723175_v01_pm_part1.mkv contains 2664 frames of DV.
### Done:seg_input=1|seg_output=1|output_frames=2664|input_frames=156222|audio_fill=0|output_file=/Volumes/FD_SSD_05/mkv/myd_723175_v01_pm_part1.mkv
### Packaging error: input-output-framecount-mismatch
### Packaging finished: /Volumes/FD_SSD_05/mkv/myd_723175_v01_pm_part1.mkv
ERROR: myd_723175_v01_pm.mkv contained 156222 DV frames, but the outputs contain 2664 frames of DV and 0 were skipped

myd_723175_v01_pm.mkv.dvrescue.xml.zip

dericed commented 11 months ago

Hi Ben, the -f flag says in the documentation

forces dvpackager to ignore changes in significant technical characteristics of the dv stream when splitting the output

so it's essentially ignoring all the prep work dvpackager usually does and mimicing an ffmpeg -i hey.dv -c copy -map 0 out.mkv, so if the dv changes specs in the middle then the output will present it all mangled.

I've been considering removing this option, as unless the dv is perfectly consistent, frame to frame, then the output would be mangled. I had this option to help with debugging in dvpackager development, but don't need it for that anymore.

dericed commented 9 months ago

Heya @bturkus, I removed the -f option in https://github.com/mipops/dvrescue/pull/788/commits/fda477874408e2af4de04db487a7ae342eabf76f