Results 1 to 7 of 7

Thread: Correcting song length in ripped flac files

  1. #1
    Outraged bystander markwoll's Avatar
    Join Date
    Nov 2012
    Location
    Northern Virginia
    Posts
    4,464

    Correcting song length in ripped flac files

    Years ago I ripped most of my collection into flacs. Around a thousand cd's
    I used cdex from several computers to my NAS.
    It turned out that the song lengths for a bunch of albums is 3:22:00 ( 3 hours 22 min )
    The other tags are correct but something about my wifi connection from one of the computers caused this to happen.
    Later I replaced the wifi and the songs ripped to the correct time length. And cd ripped from a desktop with wired ethernet were fine.
    I thought that I could fix it with Musicbrainz Picard by looking up the album and replacing the tags.
    A week or so ago I started trying to fix up tags showing errors in Bliss.
    Re - ripped some albums with dbPoweramp, that fixed it, but very time consuming. And also a great way to find cd's with unrecoverable errors ( surprise! )
    Tried MP3tag and MusicBrainz Picard to replace the tags, but Picard does not replace the song length like I thought it had in the past.
    Any suggestions on repairing the song length with a program?
    Last edited by markwoll; 04-07-2022 at 07:08 PM.
    "It is the mark of an educated mind to be able to entertain a thought without accepting it."
    -- Aristotle
    Nostalgia, you know, ain't what it used to be. Furthermore, they tells me, it never was.
    “A Man Who Does Not Read Has No Appreciable Advantage Over the Man Who Cannot Read” - Mark Twain

  2. #2
    Man of repute progmatist's Avatar
    Join Date
    Nov 2012
    Location
    Mesa, Arizona
    Posts
    3,897
    The song length error would exist in the file header, not necessarily the tag. You can use ffmpeg to correct this with the below script. Simply copy and paste the script into a text file, and change the file extension from .txt to .bat. Then copy and paste that batch file to every folder in question, and double click to execute. A new subfolder named "repaired" will be created in every folder in which it's copied and executed. That subfolder will contain the repaired flac files. The ID3 tags will be copied along with the files BTW.

    script:

    mkdir repaired
    for %%a in ("*.flac") do c:\ffmpeg\ffmpeg -i "%%a" -c copy "repaired\%%~na.flac"

    This assumes ffmpeg.exe is located in the folder also named ffmpeg on the c drive. If you place ffmpeg in some other folder, change c:\ffmpeg\ffmpeg to c:\some other folder\ffmpeg, replacing "some other folder" with whatever you name it.
    "Well my son, life is like a beanstalk, isn't it?"--Dalai Lama

  3. #3
    Outraged bystander markwoll's Avatar
    Join Date
    Nov 2012
    Location
    Northern Virginia
    Posts
    4,464
    Cool, thanks.
    "It is the mark of an educated mind to be able to entertain a thought without accepting it."
    -- Aristotle
    Nostalgia, you know, ain't what it used to be. Furthermore, they tells me, it never was.
    “A Man Who Does Not Read Has No Appreciable Advantage Over the Man Who Cannot Read” - Mark Twain

  4. #4
    Outraged bystander markwoll's Avatar
    Join Date
    Nov 2012
    Location
    Northern Virginia
    Posts
    4,464
    Hmmm, the batch ran, but didn't correct the song length
    z:\media\Music\AJ. Croce\Transit>c:\users\mark\desktop\flacfix.bat

    z:\media\Music\AJ. Croce\Transit>mkdir repaired

    z:\media\Music\AJ. Croce\Transit>for %a in ("*.flac") do c:\Users\Mark\Downloads\bliss-analyser-windows-0.1.0\ffmpeg -i "%a" -c copy "repaired\%~na.flac"

    z:\media\Music\AJ. Croce\Transit>c:\Users\Mark\Downloads\bliss-analyser-windows-0.1.0\ffmpeg -i "01-Maybe.flac" -c copy "repaired\01-Maybe.flac"
    ffmpeg version 5.0-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
    built with gcc 11.2.0 (Rev5, Built by MSYS2 project)
    configuration: --enable-gpl --enable-version3 --enable-shared --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
    libavutil 57. 17.100 / 57. 17.100
    libavcodec 59. 18.100 / 59. 18.100
    libavformat 59. 16.100 / 59. 16.100
    libavdevice 59. 4.100 / 59. 4.100
    libavfilter 8. 24.100 / 8. 24.100
    libswscale 6. 4.100 / 6. 4.100
    libswresample 4. 3.100 / 4. 3.100
    libpostproc 56. 3.100 / 56. 3.100
    Input #0, flac, from '01-Maybe.flac':
    Metadata:
    ARTIST : AJ. Croce
    ALBUM : Transit
    TITLE : Maybe
    GENRE : Blues
    DATE : 1999
    track : 01
    Duration: 03:22:53.94, start: 0.000000, bitrate: 20 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 300x300 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn (attached pic)
    Metadata:
    comment : Cover (front)
    Output #0, flac, to 'repaired\01-Maybe.flac':
    Metadata:
    ARTIST : AJ. Croce
    ALBUM : Transit
    TITLE : Maybe
    GENRE : Blues
    DATE : 1999
    track : 01
    encoder : Lavf59.16.100
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 300x300 [SAR 1:1 DAR 1:1], q=2-31, 90k tbr, 90k tbn (attached pic)
    Metadata:
    comment : Cover (front)
    Stream #0:1: Audio: flac, 44100 Hz, stereo, s16
    Stream mapping:
    Stream #0:1 -> #0:0 (copy)
    Stream #0:0 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame= 1 fps=0.0 q=-1.0 Lsize= 30383kB time=00:03:58.14 bitrate=1045.1kbits/s speed= 430x
    video:21kB audio:30353kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.027110%
    "It is the mark of an educated mind to be able to entertain a thought without accepting it."
    -- Aristotle
    Nostalgia, you know, ain't what it used to be. Furthermore, they tells me, it never was.
    “A Man Who Does Not Read Has No Appreciable Advantage Over the Man Who Cannot Read” - Mark Twain

  5. #5
    Outraged bystander markwoll's Avatar
    Join Date
    Nov 2012
    Location
    Northern Virginia
    Posts
    4,464
    Running this command worked to correct the song length and put it in the repaired folder
    z:\media\Music\AJ. Croce\Transit>c:\Users\Mark\Downloads\bliss-analyser-windows-0.1.0\ffmpeg -i 01-Maybe.flac -f flac repaired\01-Maybef.flac
    the -c might have something to do with it.
    "It is the mark of an educated mind to be able to entertain a thought without accepting it."
    -- Aristotle
    Nostalgia, you know, ain't what it used to be. Furthermore, they tells me, it never was.
    “A Man Who Does Not Read Has No Appreciable Advantage Over the Man Who Cannot Read” - Mark Twain

  6. #6
    Outraged bystander markwoll's Avatar
    Join Date
    Nov 2012
    Location
    Northern Virginia
    Posts
    4,464
    removing the -c copy fixed it in the batch. Now it will copy to a 'repaired' folder with correct song lengths.
    fixflac.bat
    Code:
    mkdir repaired
    for %%a in ("*.flac") do c:\Users\Mark\Downloads\bliss-analyser-windows-0.1.0\ffmpeg -i "%%a" -f flac "repaired\%%~na.flac"
    "It is the mark of an educated mind to be able to entertain a thought without accepting it."
    -- Aristotle
    Nostalgia, you know, ain't what it used to be. Furthermore, they tells me, it never was.
    “A Man Who Does Not Read Has No Appreciable Advantage Over the Man Who Cannot Read” - Mark Twain

  7. #7
    Man of repute progmatist's Avatar
    Join Date
    Nov 2012
    Location
    Mesa, Arizona
    Posts
    3,897
    ^^ Come to think of it, the -c copy tells ffmpeg to copy without modification. Which would of course also copy over the song length error.
    "Well my son, life is like a beanstalk, isn't it?"--Dalai Lama

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •