[FFmpeg-user] cutting mp4 with ffmpeg
Andrew Randrianasulu
randrianasulu at gmail.com
Sat Jan 13 16:25:52 EET 2024
I compiled new ffmpeg I tried to cut mp4
-to parameter was coming from mpv:
bash-5.1$ mpv ~/6029.mp4
(+) Video --vid=1 (*) (h264 720x400 25.000fps)
(+) Audio --aid=1 (*) (aac 2ch 48000Hz)
AO: [alsa] 48000Hz stereo 2ch float
VO: [gpu] 720x400 yuv420p
(Paused) AV: 00:01:04.600 / 01:28:31.600 (1%) A-V: 0.000
1 min + 4 seconds +0.600 milliseconds = 64.600 ?
bash-5.1$ /dev/shm/ffmpeg/ffmpeg -i ~/6029.mp4 -copyts -c:v copy -c:a
copy -ss 0.0 -to 64.600 /dev/shm/6029_cut.mp4
ffmpeg version N-112149-ga87a52ed0b Copyright (c) 2000-2024 the FFmpeg
developers
built with gcc 11.2.0 (GCC)
configuration:
libavutil 58. 36.101 / 58. 36.101
libavcodec 60. 37.100 / 60. 37.100
libavformat 60. 20.100 / 60. 20.100
libavdevice 60. 4.100 / 60. 4.100
libavfilter 9. 17.100 / 9. 17.100
libswscale 7. 6.100 / 7. 6.100
libswresample 4. 13.100 / 4. 13.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/guest/6029.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2011-06-24T09:52:37.000000Z
encoder : HandBrake 0.9.5 2011043000
Duration: 01:28:31.60, start: 0.000000, bitrate: 789 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 720x400, 657
kb/s, 25 fps, 25 tbr, 90k tbn (default)
Metadata:
creation_time : 2011-06-24T09:52:37.000000Z
vendor_id : [0][0][0][0]
encoder : JVT/AVC Coding
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000
Hz, stereo, fltp, 127 kb/s (default)
Metadata:
creation_time : 2011-06-24T09:52:37.000000Z
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Output #0, mp4, to '/dev/shm/6029_cut.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder : Lavf60.20.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661),
yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 720x400, q=2-31,
657 kb/s, 25 fps, 25 tbr, 90k tbn (default)
Metadata:
creation_time : 2011-06-24T09:52:37.000000Z
vendor_id : [0][0][0][0]
encoder : JVT/AVC Coding
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 127 kb/s (default)
Metadata:
creation_time : 2011-06-24T09:52:37.000000Z
vendor_id : [0][0][0][0]
Press [q] to stop, [?] for help
[out#0/mp4 @ 0xb79c180] video:5397kB audio:1009kB subtitle:0kB other
streams:0kB global headers:0kB muxing overhead: 0.732907%
size= 6453kB time=01:17:29.80 bitrate= 11.4kbits/s speed=1.21e+03x
bash-5.1$ MP4Box -info /dev/shm/6029_cut.mp4
* Movie Info *
Timescale 1000 - 2 tracks
Computed Duration 00:01:04.800 - Indicated Duration 00:01:04.800
Fragmented File: no
File Brand isom - version 512
Compatible brands: isom iso2 avc1 mp41
Created: UNKNOWN DATE Modified: UNKNOWN DATE
File has no MPEG4 IOD/OD
iTunes Info:
Encoder Software: Lavf60.20.100
1 UDTA types: meta (1)
Track # 1 Info - TrackID 1 - TimeScale 90000
Media Duration 00:01:00.040 - Indicated Duration 00:01:00.160
Track has 2 edit lists: track duration is 00:01:04.800
Media Info: Language "Undetermined (und)" - Type "vide:avc1" - 1501 samples
Visual Sample Entry Info: width=720 height=400 (depth=24 bits)
Visual Track layout: x=0 y=0 width=720 height=400
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 720 x 400
AVC Info: 1 SPS - 1 PPS - Profile High @ Level 3
NAL Unit length bits: 32
Chroma format YUV 4:2:0 - Luma bit depth 8 - chroma bit depth 8
SPS#1 hash: E2ADECEA8531A9FC07EE08593AF65A2AD75A3533
PPS#1 hash: 6BBE60BFBE383CE9144FA78B782534A704912778
Self-synchronized
RFC6381 Codec Parameters: avc1.64001E
Average GOP length: 250 samples
Max sample duration: 3600 / 90000
Track # 2 Info - TrackID 2 - TimeScale 48000
Media Duration 00:01:04.618 - Indicated Duration 00:01:04.618
Track has 1 edit lists: track duration is 00:01:04.619
Media Info: Language "Undetermined (und)" - Type "soun:mp4a" - 3029 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC (AOT=2 implicit) - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1
RFC6381 Codec Parameters: mp4a.40.2
Alternate Group ID 1
All samples are sync
Max sample duration: 1024 / 48000
bash-5.1$ /dev/shm/ffmpeg/ffprobe /dev/shm/6029_cut.mp4
ffprobe version N-112149-ga87a52ed0b Copyright (c) 2007-2024 the
FFmpeg developers
built with gcc 11.2.0 (GCC)
configuration:
libavutil 58. 36.101 / 58. 36.101
libavcodec 60. 37.100 / 60. 37.100
libavformat 60. 20.100 / 60. 20.100
libavdevice 60. 4.100 / 60. 4.100
libavfilter 9. 17.100 / 9. 17.100
libswscale 7. 6.100 / 7. 6.100
libswresample 4. 13.100 / 4. 13.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/dev/shm/6029_cut.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf60.20.100
Duration: 00:01:04.68, start: 0.000000, bitrate: 817 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 720x400, 736
kb/s, 25 fps, 25 tbr, 90k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
encoder : JVT/AVC Coding
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000
Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
=====
MB4Box from gpac 1.01. compiled without ffmpeg support.
but even ffprobe says:
Duration: 00:01:04.68 - so we have 80 milliseconds of difference from target?
MB4Box seems to say:
Computed Duration 00:01:04.800 - Indicated Duration 00:01:04.800
but for audio track
Media Duration 00:01:04.618 - Indicated Duration 00:01:04.618
Track has 1 edit lists: track duration is 00:01:04.619
so, they all a bit differ ....
More information about the ffmpeg-user
mailing list