[FFmpeg-user] Where is the fault in my dub?
Felix Muster
felixjan.muster at icloud.com
Thu Oct 17 13:53:05 EEST 2019
I want to make my own dub of a movie:
I check which frames are identical with Adobe Premiere Pro.
The UNCUT-movie has 133799 frames in Premiere but mkv-container shows
133800. So I add one frame for ffmpeg commands (+1).
Now these are the scenes I want to insert/replace (starting with
UNCUT-movie):
first/last identical Frame
UNCUT (+1)
CUT (0)
UNCUT (23.976)
ffprobe -show_entries stream=codec_type,start_time -v 0 -of compact=p=1:nk=0
THE_GIRL_WITH_THE_DRAGON_TATTOO.Title1.mkv
Start (Audio): 0.000
Start (Video): 0.000
ffprobe -show_packets THE_GIRL_WITH_THE_DRAGON_TATTOO.Title1.mkv >
stop_uncut.txt
Stop (Audio): 5580.703 (133803.0689)
Stop (Video): 5580.574 (133800)
CUT (25)
ffprobe -show_entries stream=codec_type,start_time -v 0 -of compact=p=1:nk=0
MILLENIUM_D1_VERBLENDUNG.Title0.mkv
Start (Audio): 0.000
Start (Video): 0.000
ffprobe -show_packets MILLENIUM_D1_VERBLENDUNG.Title0.mkv > stop_cut.txt
Stop (Audio): 5264.990 (131624.75)
Stop (Video): 5264.080 (131602)
1. Replace (UNCUT/CUT) - first identical Frame
25 (same frame like frame 52 in CUT)
52 (same frame like frame 25 in UNCUT)
0-24 (Frames I want to extract for UNCUT)
v0-25 (Video Frame I have to extract for UNCUT)
a0-26 (Audio "Frames" I have to extract UNCUT)
0-51 (Frames I want to extract for CUT)
v0-51 (Video Frame I have to extract for CUT)
a0-52 (Audio "Frames" I have to extract CUT)
2. Insert (UNCUT) - last identical Frame
2927
2954
2928-5177
v2929-5178
a2929-5179
3. Replace (UNCUT/CUT) - last identical Frame
133026
130803
133027-133799
v133028-133800
a133028-133803.0689
130804-131602
v130804-131602
a130804-131624.75
My ffmpeg-syntax looks like this:
mkvmerge -i MILLENIUM_D1_VERBLENDUNG.Title0.mkv
mkvextract MILLENIUM_D1_VERBLENDUNG.Title0.mkv tracks 0:video_cut.264
mkvmerge -i THE_GIRL_WITH_THE_DRAGON_TATTOO.Title1.mkv
mkvextract THE_GIRL_WITH_THE_DRAGON_TATTOO.Title1.mkv tracks
0:video_uncut.264
ffmpeg.exe -i MILLENIUM_D1_VERBLENDUNG.Title0.mkv -map 0:1 -c:a flac
-sample_fmt:a s16 audio_cut.flac
ffmpeg.exe -i THE_GIRL_WITH_THE_DRAGON_TATTOO.Title1.mkv -map 0:2 -c:a flac
-sample_fmt:a s16 audio_uncut.flac
atempo = (24000/1001)/25
ffmpeg.exe -i audio_cut.flac -filter:a "atempo=0.959040959"
audio_cut_23976fps_atempo.flac
Part 1:
ffmpeg.exe -i audio_cut_23976fps_atempo.flac -t (52/(24000/1001)) -codec
flac audio_cut_1.flac
ffmpeg.exe -i audio_cut_23976fps_atempo.flac -t 2.168833333 -codec flac
audio_cut_1.flac
Rest 1:
ffmpeg.exe -i audio_cut_23976fps_atempo.flac -ss (52/(24000/1001)) -to
(131624.75/(24000/1001)) -codec flac audio_cut_R1.flac
ffmpeg.exe -i audio_cut_23976fps_atempo.flac -ss 2.168833333 -to 5489.848948
-codec flac audio_cut_R1.flac
Part 2:
ffmpeg.exe -i audio_cut_R1.flac -t ((2954-52)/(24000/1001)) -codec flac
audio_cut_2.flac
ffmpeg.exe -i audio_cut_R1.flac -t 121.0375833 -codec flac audio_cut_2.flac
Rest 2:
ffmpeg.exe -i audio_cut_23976fps_atempo.flac -ss
(((2954-52)+52)/(24000/1001)) -to (131624.75/(24000/1001)) -codec flac
audio_cut_R2.flac
ffmpeg.exe -i audio_cut_23976fps_atempo.flac -ss 123.2064167 -to 5489.848948
-codec flac audio_cut_R2.flac
Part 3:
ffmpeg.exe -i audio_cut_R2.flac -t ((130803-(2954-52)-52)/(24000/1001))
-codec flac audio_cut_3.flac
ffmpeg.exe -i audio_cut_R2.flac -t 5332.368708 -codec flac audio_cut_3.flac
Rest 3:
ffmpeg.exe -i audio_cut_23976fps_atempo.flac -ss
(((130803-(2954-52)-52)+(2954-52)+52)/(24000/1001)) -to
(131624.75/(24000/1001)) -codec flac audio_cut_R3.flac
ffmpeg.exe -i audio_cut_23976fps_atempo.flac -ss 5455.575125 -to 5489.848948
-codec flac audio_cut_R3.flac
New 1:
ffmpeg.exe -i audio_uncut.flac -ss (0/(24000/1001)) -to (26/(24000/1001))
-codec flac audio_uncut1.flac
ffmpeg.exe -i audio_uncut.flac -ss 0 -to 1.084416667 -codec flac
audio_uncut_1.flac
New 2:
ffmpeg.exe -i audio_uncut.flac -ss (2929/(24000/1001)) -to
(5179/(24000/1001)) -codec flac audio_uncut2.flac
ffmpeg.exe -i audio_uncut.flac -ss 122.1637083 -to 216.0074583 -codec flac
audio_uncut_2.flac
New 3:
ffmpeg.exe -i audio_uncut.flac -ss (133028/(24000/1001)) -to
(133803.0689/(24000/1001)) -codec flac audio_uncut3.flac
ffmpeg.exe -i audio_uncut.flac -ss 5548.376167 -to 5580.702999 -codec flac
audio_uncut_3.flac
ffmpeg -f concat -i mylist1.txt -c flac audio_final.flac
file 'audio_uncut_1.flac'
file 'audio_cut_2.flac'
file 'audio_uncut_2.flac'
file 'audio_cut_3.flac'
file 'audio_uncut_3.flac'
ffprobe.exe -v 0 -sexagesimal -show_entries format^=duration -of
compact^=p^=0^:nk^=1 audio_final.flac
ffmpeg^
-i THE_GIRL_WITH_THE_DRAGON_TATTOO.Title1.mkv -i audio_final.flac^
-map 0:0 -map 1:0^
-codec copy^
final.mkv
The mkv seems to be synchronous but ...
... audio_final.flac has 1:33:00.661 and audio_uncut.flac 1:33:00.703. So
the difference is 0.042 sec --> one frame.
Where I lost one frame in my calculation.
I looked at the code for hours now and cannot see it.
More information about the ffmpeg-user
mailing list