Verketten Sie mit ffmpeg mp4-Dateien mit verschiedenen fps und sar

496
Dmitriy

Ich muss sechs mp4-Dateien in eine zusammenführen. Hier sind die Informationen zu den Dateien:

pt1.mp4

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 854x480 [SAR 1:1 DAR 427:240], 998 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, 47.95 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default) 

pt2.mp4

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 854x480 [SAR 1280:1281 DAR 16:9], 1000 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 130 kb/s (default) 

pt3.mp4

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 854x480 [SAR 1280:1281 DAR 16:9], 1001 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn,  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default) 

pt4.mp4

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 854x480 [SAR 1280:1281 DAR 16:9], 990 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn,  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default) 

pt5.mp4

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 854x480 [SAR 1280:1281 DAR 16:9], 994 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn,  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default) 

pt6.mp4

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 854x480 [SAR 1280:1281 DAR 16:9], 997 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn,  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default) 

Nachdem Sie die Dokumentation zu ffmpeg gelesen haben, konvertieren Sie die Dateien in ts und dann concat:

ffmpeg -i pt1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts pt1.ts ... ffmpeg -i pt6.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts pt6.ts ffmpeg -i concat:"pt1.ts|pt2.ts|pt3.ts|pt4.ts|pt5.ts|pt6.ts" -c copy -bsf:a aac_adtstoasc output.mp4 

Leider funktioniert die resultierende Datei nicht normal, obwohl die Dateien separat funktionieren.

Hier ist das Protokoll der Verkettung:

Input #0, mpegts, from 'concat:pt1.ts|pt2.ts|pt3.ts|pt4.ts|pt5.ts|pt6.ts': Duration: 00:33:11.57, start: 1.400000, bitrate: 7453 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 854x480 [SAR 1:1 DAR 427:240], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc Stream #0:1[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 125 kb/s [mp4 @ 0x12e3080] Codec for stream 0 does not use global headers but container format requires global headers [mp4 @ 0x12e3080] Codec for stream 1 does not use global headers but container format requires global headers Output #0, mp4, to 'output.mp4': Metadata: encoder : Lavf56.40.101 Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 854x480 [SAR 1:1 DAR 427:240], q=2-31, 23.98 fps, 23.98 tbr, 90k tbn, 90k tbc Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 125 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [mp4 @ 0x12e3080] Non-monotonous DTS in output stream 0:1; previous: 195910409, current: 195909909; changing to 195910410. This may result in incorrect timestamps in the output file. [mp4 @ 0x12e3080] Non-monotonous DTS in output stream 0:1; previous: 301545749, current: 301545544; changing to 301545750. This may result in incorrect timestamps in the output file. [mp4 @ 0x12e3080] Non-monotonous DTS in output stream 0:1; previous: 475343963, current: 475340939; changing to 475343964. This may result in incorrect timestamps in the output file. [mp4 @ 0x12e3080] Non-monotonous DTS in output stream 0:1; previous: 475343964, current: 475341963; changing to 475343965. This may result in incorrect timestamps in the output file. [mp4 @ 0x12e3080] Non-monotonous DTS in output stream 0:1; previous: 475343965, current: 475342987; changing to 475343966. This may result in incorrect timestamps in the output file. frame=294625 fps=38748 q=-1.0 Lsize= 1645766kB time=03:18:14.48 bitrate=1133.5kbits/s video:1449809kB audio:186316kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.589257% 

Vielleicht liegt dies an einer anderen Framerate, fünf Stück FPS 23,98 und einem 29,97?

0
* weigert sich normal zu arbeiten * -> bedeutung? Gyan vor 5 Jahren 1
@Gyan, Player meldet Fehler bei der Videodekodierung Dmitriy vor 5 Jahren 0
Welcher Spieler? Zeigt ffplay es gut? Gyan vor 5 Jahren 0
@Gyan, Plex auf Sony Bravia KDL-42W653A, andere Player funktionieren gut, aber wenn das Video zurückgespult wird, hängen sie. Dmitriy vor 5 Jahren 0

0 Antworten auf die Frage