When ripping the extra BD's from the Extended 3-disk versions of The Hobbit (9 BDs in total for the three movies), I found several files from the first and some from the second movie on the respective extra disks, that had files with a far longer audio track than video track.
A check showed this:
tja@mini:/Volumes/MEDIA2/INBOX/DONE/The Hobbit AUJ- The Appendices Part 7- A Long-Expected Journey$ for s in 0 1 2 3 4; do ffprobe8 -v error -select_streams "$s" -show_entries packet=pts_time,dts_time -of csv=p=0 *"A Long-Expected Journey_t05.mkv" | awk -F, -v s="$s" '{for(i=1;i<=NF;i++) if($i!="N/A" && $i ~ /^[0-9.]+$/) last=$i} END{printf "stream %s last packet: %.3f\n", s, last}'; done
stream 0 last packet: 656.948
stream 1 last packet: 1552.480
stream 2 last packet: 652.026
stream 3 last packet: 652.026
stream 4 last packet: 652.026
Lots of lots of files showed this mistake.
Maybe make sure to cut a file when there is no video stream anymore?
Other ideas?
Generic problem with longer audio tracks
Re: Generic problem with longer audio tracks
I should add that VLC simply seems to stop in the middle of the file, after the video part ends.
I could fix the file like this:
f="A Long-Expected Journey_t05.mkv"; last=$(ffprobe8 -v error -select_streams v:0 -show_entries frame=best_effort_timestamp_time,pkt_dts_time -of csv=p=0 "$f" | awk -F, '{for(i=1;i<=NF;i++) if($i!="N/A" && $i ~ /^[0-9.]+$/) last=$i} END{printf "%.3f", last+0.1}'); ffmpeg8 -hide_banner -i "$f" -map 0 -t "$last" -c copy "FIXED-$f"
I could fix the file like this:
f="A Long-Expected Journey_t05.mkv"; last=$(ffprobe8 -v error -select_streams v:0 -show_entries frame=best_effort_timestamp_time,pkt_dts_time -of csv=p=0 "$f" | awk -F, '{for(i=1;i<=NF;i++) if($i!="N/A" && $i ~ /^[0-9.]+$/) last=$i} END{printf "%.3f", last+0.1}'); ffmpeg8 -hide_banner -i "$f" -map 0 -t "$last" -c copy "FIXED-$f"