VideoHelp Forum





Try StreamFab Downloader and download streaming video from Netflix, Amazon!



+ Reply to Thread
Results 1 to 15 of 15
  1. Member
    Join Date
    Sep 2005
    Location
    Darkest Peru
    Search Comp PM
    I've live download from this network before. I can't remember if I'm doing anything different so I don't know if this is my fault or if they've changed something.

    https://www.wthr.com/watch

    I've tried using n_m3u8dl-re and yt-dlp. It seems successful, but it goes wrong when they have a commercial.

    The video downloads during the commercials, but the audio track doesn't. So playing it back the audio of the program continues to play during the commercial break, and of course when the show returns the audio is out of sync.

    0.m3u8 is the 1080p version of the stream and index.m3u8 has the same result.

    Any suggestions?
    Quote Quote  
  2. n_m3u8dl-re --live-real-time-merge "https://video.tegnaone.com/wthr/live/v1/manifest/f9c1bf9ffd6ac86b6173a7c169ff6e3f4efbd693/WTHR-Production/fca34a67-d7bd-4404-a76a-4982c4c15a74/0.m3u8"
    Quote Quote  
  3. Member
    Join Date
    Sep 2005
    Location
    Darkest Peru
    Search Comp PM
    Edit:
    Ah. The issue was that I had "-M format=mp4". It 'fixes' the timing issues, which is what causes the problem. It apparently has to remain .ts(?)

    Playing it back and the time on my media player goes nuts.

    Is this them, me, and/or something that can be repaired?
    Last edited by doctorm; 19th May 2026 at 19:03.
    Quote Quote  
  4. What's the problem?
    Quote Quote  
  5. Member
    Join Date
    Sep 2005
    Location
    Darkest Peru
    Search Comp PM
    The audio goes out of sync in mp4 format.
    Kept in .ts format it freezes occasionally on playback and when a commercial comes up the time on my media player can jump from 00:06:30 and to 02:12:00 or 530:00:00 while the commercial is playing without sound. The time codes are really messed up.
    Quote Quote  
  6. n_m3u8dl-re --live-real-time-merge "https://video.tegnaone.com/wthr/live/v1/manifest/f9c1bf9ffd6ac86b6173a7c169ff6e3f4efbd693/WTHR-Production/fca34a67-d7bd-4404-a76a-4982c4c15a74/0.m3u8"
    Quote Quote  
  7. Member
    Join Date
    Sep 2005
    Location
    Darkest Peru
    Search Comp PM
    Have you tried downloading for 10-15 minutes and recording commercial breaks? This just doesn't come out as having good timing and audio sync once there is a commercial.
    The commercials don't even have any audio.
    Quote Quote  
  8. https://gofile.io/d/VcpKNv

    The commercials donīt show video, only an static image with audio, but when it starts again the show, the audio is okay. (See it yourself, advance to 02:50 on the video file that I uploaded)
    Try the chrome extension called "Stre am Recor der - HLS & m3u8 Video Downloader" (without spaces in its name) to do it.
    Quote Quote  
  9. Member
    Join Date
    Sep 2005
    Location
    Darkest Peru
    Search Comp PM
    Originally Posted by Asdfgf View Post
    https://gofile.io/d/VcpKNv

    The commercials donīt show video, only an static image with audio, but when it starts again the show, the audio is okay. (See it yourself, advance to 02:50 on the video file that I uploaded)
    Try the chrome extension called "Stre am Recor der - HLS & m3u8 Video Downloader" (without spaces in its name) to do it.
    Thanks. Feels like a cheat, but it seems to work well.
    Here's an example of what n_m3u8dl-re was doing (and I think yt-dlp was as well). While this has the audio go out of sync, in .ts format the video played back awkward and the time positions were all over the place. Trying to manually fix the timing issue with ffmpeg had the same result.
    https://gofile.io/d/Yr1D8T

    Edit: Tested this extension multiple times and it works like a charm. I don't love that it downloads the stream to their servers and then you download it from them, but it works. I wish I knew how it did it though.
    Last edited by doctorm; 23rd May 2026 at 20:57.
    Quote Quote  
  10. 1. Download.

    n_m3u8dl-re "https://video.tegnaone.com/wthr/live/v1/manifest/f9c1bf9ffd6ac86b6173a7c169ff6e3f4efbd693/WTHR-Production/fca34a67-d7bd-4404-a76a-4982c4c15a74/0.m3u8"

    2. Saving.

    a) Ctrl+C
    b) In the '0____' folder there are 'ts' files with an eight-character name (1323xxxx) and a ten-character name (17796xxxxx).
    c) Delete all files with an eight-character name (1323xxxx).
    d) In the '0____' folder, start a command prompt and run:
    copy /b *ts video.ts
    Quote Quote  
  11. Member
    Join Date
    Sep 2005
    Location
    Darkest Peru
    Search Comp PM
    Is there a windows command that will delete files based on number of characters? I've tried ????????.ts but that doesn't work right.

    Edit: Testing some things, I mistyped something and it worked...
    Code:
    copy /b *~?.ts video.ts
    I think I get it though.

    If you use:
    Code:
    dir /x
    it lists 8 character files untouched. 10 character files are named xxxxxx~1, xxxxxx~2, etc.
    By using a question mark after the tilde, instead of a number, it uses ALL files of that length.
    Pretty narrow use, but perfect in this case.

    Edit again: btw, that 0.m3u8 has expired.
    Last edited by doctorm; 24th May 2026 at 21:27.
    Quote Quote  
  12. 1. Delete:

    del /q 13*

    2. I used 'xxxxx.0.m3u8' for example only.
    Last edited by LZAA; 25th May 2026 at 10:03.
    Quote Quote  
  13. Firstly, I would like to thank LZAA for getting the solution to this problem

    Secondly, with the help of gemini we wrote this python script and I packaged it into .exe for simplicity

    It automatas the recording and will do the merging and conversion and cleanup automatically

    Here is the script in case you want to edit/add anything
    Code:
    import os
    import subprocess
    import glob
    import shutil
    
    def convert_minutes_to_time_str(minutes):
        """Converts minutes (e.g., 30) into HH:MM:SS format (e.g., 00:30:00)"""
        total_seconds = int(minutes) * 60
        hours = total_seconds // 3600
        minutes = (total_seconds % 3600) // 60
        seconds = total_seconds % 60
        return f"{hours:02d}:{minutes:02d}:{seconds:02d}"
    
    def main():
        # 1. Gather User Inputs
        m3u8_url = input("Enter m3u8 URL: ").strip()
        filename = input("Enter output filename (without extension): ").strip()
        video_format = input("Enter video format (e.g., mkv, mp4): ").strip().replace(".", "")
        duration_mins = input("Enter duration of recording in minutes: ").strip()
        
        # Format the duration for N_m3u8dl-re
        time_limit_str = convert_minutes_to_time_str(duration_mins)
        
        # 2. Run N_m3u8dl-re recording command
        print("\n--- Starting Recording ---")
        record_cmd = [
            "N_m3u8dl-re", 
            m3u8_url, 
            "--save-name", filename, 
            "--live-wait-time", "5", 
            "--live-record-limit", time_limit_str
        ]
        subprocess.run(record_cmd)
        
        # 3. Navigate into the output directory created by N_m3u8dl-re
        target_dir = os.path.abspath(filename)
        if not os.path.exists(target_dir):
            print(f"Error: Expected directory '{target_dir}' was not found.")
            return
    
        # Find the subfolder inside
        subfolders = [d for d in glob.glob(os.path.join(target_dir, "*")) if os.path.isdir(d)]
        if not subfolders:
            print("Error: No subdirectory found inside the recording folder.")
            return
        
        working_dir = subfolders[0]
        print(f"Working inside segment folder: {working_dir}")
        
        # 4. Filter and delete files (8-digit OR less than 2MB)
        print("Filtering segments (removing ads & short chunks)...")
        
        # 2 MB in bytes = 2 * 1024 * 1024
        TWO_MB_IN_BYTES = 2097152 
        
        for file_path in glob.glob(os.path.join(working_dir, "*.*.ts")) + glob.glob(os.path.join(working_dir, "*.ts")):
            # Ensure we don't accidentally target a file that doesn't exist anymore
            if not os.path.exists(file_path):
                continue
                
            base_name = os.path.splitext(os.path.basename(file_path))[0]
            
            try:
                file_size = os.path.getsize(file_path)
                
                # Condition 1: It's an 8-digit filename
                is_8_digits = base_name.isdigit() and len(base_name) == 8
                
                # Condition 2: File size is strictly less than 2 MB
                is_under_2mb = file_size < TWO_MB_IN_BYTES
                
                if is_8_digits or is_under_2mb:
                    # Print a log so you know exactly what's being tossed out
                    reason = "8-digit name" if is_8_digits else f"under 2MB ({file_size / (1024*1024):.2f} MB)"
                    print(f"Deleting ad/garbage segment: {os.path.basename(file_path)} -> Reason: {reason}")
                    os.remove(file_path)
                    
            except Exception as e:
                print(f"Could not process/delete {os.path.basename(file_path)}: {e}")
    
        # Change current working directory to execute copy /b smoothly
        original_cwd = os.getcwd()
        os.chdir(working_dir)
    
        # Double check if there are any .ts files left to merge
        remaining_ts = glob.glob("*.ts")
        if not remaining_ts:
            print("Error: No .ts files left after filtering! Adjust your size threshold.")
            os.chdir(original_cwd)
            return
    
        # 5. Merge the remaining valid .ts files
        print("Merging remaining segments...")
        subprocess.run("copy /b *ts video.ts", shell=True)
        
        # 6. Convert to user's desired format using FFmpeg
        output_video_name = f"{filename}.{video_format}"
        print(f"Converting to {output_video_name}...")
        ffmpeg_cmd = ["ffmpeg", "-i", "video.ts", "-c", "copy", output_video_name]
        subprocess.run(ffmpeg_cmd)
        
        # 7. Cleanup and Move final file back to root
        os.makedirs(os.path.join(original_cwd, "recordings"), exist_ok=True)
        final_output_path = os.path.join(original_cwd, "recordings", output_video_name)
        
        if os.path.exists(output_video_name):
            shutil.move(output_video_name, final_output_path)
            print(f"Success! Saved final video to: {final_output_path}")
        else:
            print("Error: Final video conversion failed.")
    
        # Switch back to main script folder and wipe temp files
        os.chdir(original_cwd)
        print("Cleaning up temporary recording folders...")
        try:
            shutil.rmtree(target_dir)
        except Exception as e:
            print(f"Warning: Could not completely remove temp folder {target_dir}: {e}")
    
    if __name__ == "__main__":
        while True:
            main()
            cont = input("\nDo you want to record another stream? (y/n): ").strip().lower()
            if cont != 'y':
                print("Exiting the recorder. Goodbye!")
                break
    The m3u8 url I used is the index.m3u8
    Code:
    https://video.tegnaone.com/wthr/live/v1/master/f9c1bf9ffd6ac86b6173a7c169ff6e3f4efbd693/WTHR-Production/live/index.m3u8
    Here is a video I tested recording for (40 minutes) but after removing ads its become ~26 minutes.. just in case you want to check the result
    https://gofile.io/d/XCG9IY

    Finally, here it is
    https://files.videohelp.com/u/315187/recorder.exe

    Cheers
    Quote Quote  
  14. Member
    Join Date
    Sep 2005
    Location
    Darkest Peru
    Search Comp PM
    Sounds good, xangetsue, but I use windows batch scripts and wrote that last night.

    As far as "del /q 13*" goes, I don't know if all their commercials will always be 13*, 8 digit names or what. I didn't want separate based on 13* and 17* which is what I was currently downloading.
    For now it should work fine though.
    Quote Quote  
  15. Originally Posted by doctorm View Post
    Sounds good, xangetsue, but I use windows batch scripts and wrote that last night.

    As far as "del /q 13*" goes, I don't know if all their commercials will always be 13*, 8 digit names or what. I didn't want separate based on 13* and 17* which is what I was currently downloading.
    For now it should work fine though.
    Unfortunately, I noticed a 10-digit .ts file that turned out to be an ad. To fix this, I updated the script to search for filenames with fewer than 10 digits, as well as files under 2 MB, which are highly likely to be ads. It worked perfectly
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!