File size: 1,547 Bytes
9e060c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import subprocess

TARGET_FILE = "/mnt/jonathanDisk/ivritData/讬讚 讬爪讞拽 讘谉-爪讘讬/2011.06.14 诪讚专砖讬 讗讙讚讛 讘讗专抓 讬砖专讗诇 讜转驻讜爪转诐 - 讗讘讬讙讚讜专 砖谞讗谉.m4a"

def main():
    print(f"Interrogating:\n{TARGET_FILE}\n")

    # --- 1. THE METADATA (The Header) ---
    print("1. Reading Metadata (The Header)...")
    try:
        meta_cmd = [
            "ffprobe", "-v", "error", 
            "-show_entries", "format=duration", 
            "-of", "default=noprint_wrappers=1:nokey=1", 
            TARGET_FILE
        ]
        meta_seconds = float(subprocess.check_output(meta_cmd).decode().strip())
        meta_mins = meta_seconds / 60
        print(f"   Result: {meta_seconds:.2f} seconds ({meta_mins:.2f} minutes)")
    except Exception as e:
        print(f"   Failed to read metadata: {e}")

    # --- 2. THE PHYSICAL REALITY (The Stream) ---
    print("\n2. Decoding physical packets (The Truth)...")
    print("   (Reading all bytes to find the physical cliff. Takes a few seconds...)")
    try:
        # We use tr '\r' '\n' to catch ffmpeg's updating progress bar
        phys_cmd = f"ffmpeg -v info -i '{TARGET_FILE}' -f null - 2>&1 | tr '\\r' '\\n' | grep 'time=' | tail -n 1"
        phys_out = subprocess.check_output(phys_cmd, shell=True).decode().strip()
        
        # phys_out looks like: "size=N/A time=00:32:51.05 bitrate=N/A speed= 341x"
        print(f"   Result: {phys_out}")
    except Exception as e:
        print(f"   Failed to decode stream: {e}")

if __name__ == "__main__":
    main()