ffmpeg fails to copy correct duration - ffmpeg

I want to trim a video with the following command:
ffmpeg.exe -i in.mp4 -ss 76 -t 10 -c copy -an out.mp4
which exactly means, copy 10 seconds after 76 seconds, and don't copy audio. However out.mp4 is 5 seconds length.
This is ffmpeg console output:
ffmpeg.exe -i in.mp4 -ss 76 -t 10 -c copy -an out.mp4
ffmpeg version N-78197-g5893e87 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzli
b --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libblu
ray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enab
le-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --ena
ble-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --en
able-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --
enable-lzma --enable-decklink --enable-zlib
libavutil 55. 16.101 / 55. 16.101
libavcodec 57. 22.102 / 57. 22.102
libavformat 57. 23.101 / 57. 23.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 27.100 / 6. 27.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.63.104
Duration: 00:02:28.54, start: 0.000000, bitrate: 2018 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1056 [SAR 1:1 DAR 20:11]
, 1887 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default
)
Metadata:
handler_name : SoundHandler
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.23.101
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1056 [SAR 1:1 DAR 20:11],
q=2-31, 1887 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 90k tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 143 fps=0.0 q=-1.0 Lsize= 1502kB time=00:00:09.96 bitrate=1235.5kbits/s speed= 524x
video:1499kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.194616%
When I analyze this console output I see this inconsistency. It says output time is 9.96 seconds. On the other hand it says frame is 143, so from the latter information I can calculate duration by frame/fps which is 143/23.98=5.96.
Another strange behaviour with this copy command is when I change the start time to something else output video length is varying between 5-10 seconds depending on the start time.
What might be the problem causing these unexpected behaviours?

ffmpeg only cuts at keyframes, so with inter-coded streams, you may not get exact duration. You'll have to transcode the video for a precise cut.
ffmpeg.exe -ss 76 -t 10 -i in.mp4 -an out.mp4
(Placing the -ss and -t before the input will make ffmpeg seek to the position and then decode frames. Placing them afterwards means ffmpeg decodes all frames and then discards till start time is reached)

Related

FFMPEG command not working on MP4 files as expected

I am trying to set the output time offset for mp4 file.
ffmpeg -ss 13.554000 -i input.mp4 -c copy -t 10 -output_ts_offset 13.554000 output.mp4
This code works for WEBM file as expected but not for MP4.
In webm it delays start time of video to the specified timestamp and duration is 23.554 but in mp4 it just cuts the video, start time is set to 0 and duration is 10
Cannot find what is problem.
ffmpeg -ss 12.960000 -i v.mp4 -c copy -t 10 -output_ts_offset 12.960000 output.mp4
ffmpeg version git-2019-12-26-b0d0d7e Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.2.1 (GCC) 20191125
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig
--enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora
--enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis
--enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid
--enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
--enable-libopenmpt --enable-amf
libavutil 56. 37.100 / 56. 37.100
libavcodec 58. 65.100 / 58. 65.100
libavformat 58. 35.101 / 58. 35.101
libavdevice 58. 9.101 / 58. 9.101
libavfilter 7. 69.101 / 7. 69.101
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'v.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01T00:00:00.000000Z
encoder : Lavf53.24.2
Duration: 00:00:29.57, start: 0.000000, bitrate: 1421 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1032 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : SoundHandler
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.35.101
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1032 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 250 fps=0.0 q=-1.0 Lsize= 1687kB time=00:00:09.99 bitrate=1382.7kbits/s speed=2.21e+03x
video:1212kB audio:468kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.408804%```

How to concatenate two or more videos with same width and different height in FFMpeg and to maintain the same aspect ratio?

I have five video parts to concat all. Each five videos are in the same width and height. The second part is the hstack of another 2 videos and the third part is the hstack and vstack of another 3 videos. While concat all the five video parts the aspect ratio is not maintaining in the final video. Since I am new to ffmpeg help me to sort out the problem
I have tried with the command in my final with filter complex and to reduce the size I used frame per second.
"ffmpeg -i
final.mp4 -vf scale=1280:480 -filter:v fps=fps=30 finalNew.mp4"
but nothing worked.
Also help me to use hstack with scaling, to maintain the aspect ratio for the second part on below command
Command: ffmpeg -i vid1.mkv -i vid2.mkv -filter_complex "[0:v]scale=-1:480[v0];[0:v][1:v]hstack=inputs=2"vid3.mkv
Images
second part
third part
videochunks
I have console the info of my video
ffmpeg -i part1.mkv -i part2.mkv -i part3.mkv -i part4.mkv -i part5.mkv
ffmpeg version N-94911-g197985c5bf Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 35.100 / 56. 35.100
libavcodec 58. 56.101 / 58. 56.101
libavformat 58. 32.104 / 58. 32.104
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.102 / 7. 58.102
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, matroska,webm, from 'part1.mkv':
Metadata:
ENCODER : Lavf58.32.104
Duration: 00:00:44.00, start: 0.000000, bitrate: 189 kb/s
Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 640x480 [SAR 9:16 DAR 3:4], 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
Metadata:
title : Video
ENCODER : Lavc58.56.101 libx264
DURATION : 00:00:44.000000000
Input #1, matroska,webm, from 'part2.mkv':
Metadata:
ENCODER : Lavf58.32.104
Duration: 00:01:22.07, start: 0.000000, bitrate: 113 kb/s
Stream #1:0: Video: h264 (High), yuv420p(progressive), 640x240 [SAR 9:16 DAR 3:2], 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
Metadata:
ENCODER : Lavc58.56.101 libx264
DURATION : 00:01:22.066000000
Input #2, matroska,webm, from 'part3.mkv':
Metadata:
ENCODER : Lavf58.32.104
Duration: 00:00:42.03, start: 0.000000, bitrate: 405 kb/s
Stream #2:0: Video: h264 (High), yuv420p(progressive), 640x720 [SAR 9:16 DAR 1:2], 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
Metadata:
ENCODER : Lavc58.56.101 libx264
DURATION : 00:00:42.033000000
Input #3, matroska,webm, from 'part4.mkv':
Metadata:
ENCODER : Lavf58.32.104
Duration: 00:00:21.00, start: 0.000000, bitrate: 298 kb/s
Stream #3:0: Video: h264 (High), yuv420p(progressive), 640x240 [SAR 9:16 DAR 3:2], 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
Metadata:
ENCODER : Lavc58.56.101 libx264
DURATION : 00:00:21.000000000
Input #4, matroska,webm, from 'part5.mkv':
Metadata:
ENCODER : Lavf58.32.104
Duration: 00:00:16.00, start: 0.000000, bitrate: 169 kb/s
Stream #4:0(eng): Video: h264 (High), yuv420p(progressive), 640x480 [SAR 9:16 DAR 3:4], 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
Metadata:
title : Video
ENCODER : Lavc58.56.101 libx264
DURATION : 00:00:16.000000000
If you want to keep the 9:16 SAR of the inputs:
ffmpeg -i part1.mkv -i part2.mkv -i part3.mkv -i part4.mkv -i part5.mkv -filter_complex "[0]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=9/16[0v];[1]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=9/16[1v];[2]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=9/16[2v];[3]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=9/16[3v];[4]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=9/16[4v];[0v][1v][2v][3v][4v]concat=n=5:v=1:a=0[v]" -map "[v]" output.mp4
But your inputs look stretched, so I assume you want a 1:1 SAR:
ffmpeg -i part1.mkv -i part2.mkv -i part3.mkv -i part4.mkv -i part5.mkv -filter_complex "[0]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=1[0v];[1]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=1[1v];[2]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=1[2v];[3]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=1[3v];[4]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=1[4v];[0v][1v][2v][3v][4v]concat=n=5:v=1:a=0[v]" -map "[v]" output.mp4

ffmpeg lose frames when extracting them

When I extract all frames from a video, FFmpeg lose one frame. I tried multiple options, like adding more parameters to the function, but none of them worked.
ffmpeg -i Multicam420-30a.mp4 -framerate 30 frame%08d.jpg
ffmpeg version N-94077-g01d8c72b95 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190621
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 29.100 / 56. 29.100
libavcodec 58. 53.100 / 58. 53.100
libavformat 58. 28.100 / 58. 28.100
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 55.100 / 7. 55.100
libswscale 5. 4.101 / 5. 4.101
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0000023af91f9e80] st: 0 edit list: 1 Missing key frame while searching for timestamp: 0
[mov,mp4,m4a,3gp,3g2,mj2 # 0000023af91f9e80] st: 0 edit list 1 Cannot find an index entry before timestamp: 0.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Multicam420-30a.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: mp41mp42
creation_time : 2019-08-20T01:30:57.000000Z
Duration: 00:00:01.00, start: 0.000000, bitrate: 11208 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 11007 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default)
Metadata:
creation_time : 2019-08-20T01:30:57.000000Z
encoder : AVC Coding
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
creation_time : 2019-08-20T01:30:57.000000Z
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler # 0000023afb923740] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'frame%08d.jpg':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: mp41mp42
encoder : Lavf58.28.100
Stream #0:0(eng): Video: mjpeg, yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
Metadata:
creation_time : 2019-08-20T01:30:57.000000Z
encoder : Lavc58.53.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 29 fps= 17 q=24.8 Lsize=N/A time=00:00:00.96 bitrate=N/A speed=0.557x
video:3153kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
As you can see, the original video has 30 frames and last 1 second, and the output frames are 29 and less than a second.

FFMpeg - can't manage to create DnxHR files in Rec2020 / 4:4:4 Chroma sampling

I'm trying to convert an image sequence into a Quicktime DnxHR with 4:4:4 sampling in Rec2020 colorspace using FFMpeg 4.1.3. But I'm always ending with 4:2:0 Rec709 file.
In my lastest attempt FFMpeg seems to de the right thing :
ffmpeg.exe -y -i "C:/TEST/final-%04d.dpx" -c:v dnxhd -vf "scale=3840:2160,fps=24,format=yuv444p12le" -profile:v dnxhr_444 -color_primaries 9 -colorspace 9 -color_range 2 C:/TEST/test.mov
During encoding the output stream is shown as 444 / bt2020
Output #0, mov, to 'C:/TEST/test.mov':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: dnxhd (DNXHR 444) (AVdh / 0x68645641), yuv444p10le(pc, bt2020nc/bt2020/unknown), 3840x2160, q=2-1024, 200 kb/s, 24 fps, 12288 tbn, 24 tbc
Metadata:
encoder : Lavc58.35.100 dnxhd
frame= 10 fps=3.3 q=1.0 Lsize= 71161kB time=00:00:00.37
bitrate=1554195.5kbits/s speed=0.122x
video:71160kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001114%
But when I inspect the output file FFMpeg says it's in bt709
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:/TEST/test.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf58.20.100
Duration: 00:00:00.42, start: 0.000000, bitrate: 1397959 kb/s
Stream #0:0(eng): Video: dnxhd (DNXHR 444) (AVdh / 0x68645641),
yuv444p10le(pc, bt709/unknown/unknown), 3840x2160, 1399062 kb/s, 24 fps, 24 tbr, 12288 tbn, 12288 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.35.100 dnxhd
And softwares like MediaInfo say the chroma sampling is in 4.2.0
Any ideas ?
As ask in the comment, the full log of the conversion :
C:\Users\pierrech>ffmpeg.exe -y -i "C:/TEST/final-%04d.dpx" -c:v dnxhd -vf colorspace=all=bt2020:iall=bt2020 -profile:v dnxhr_444 -color_primaries bt2020 -colorspace bt2020_ncl -color_range 2 -color_trc bt2020_12bit C:/TEST/test.mov
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.3.1 (GCC) 20190414
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, image2, from 'C:/TEST/final-%04d.dpx':
Duration: 00:00:00.40, start: 0.000000, bitrate: N/A
Stream #0:0: Video: dpx, rgb48le, 3840x2160, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (dpx (native) -> dnxhd (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'C:/TEST/test.mov':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: dnxhd (DNXHR 444) (AVdh / 0x68645641), yuv444p10le(pc, bt2020nc/bt2020/bt2020-12), 3840x2160, q=2-1024, 200 kb/s, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 dnxhd
frame= 10 fps=3.8 q=1.0 Lsize= 71161kB time=00:00:00.36 bitrate=1618952.6kbits/s speed=0.136x
video:71160kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001114%
And after the conversion
C:\Users\pierrech>ffmpeg.exe -i C:\TEST\test.mov -hide_banner
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\TEST\test.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf58.20.100
Duration: 00:00:00.40, start: 0.000000, bitrate: 1457373 kb/s
Stream #0:0(eng): Video: dnxhd (DNXHR 444) (AVdh / 0x68645641), yuv444p10le(pc, bt709/unknown/unknown), 3840x2160, 1457356 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.35.100 dnxhd
At least one output file must be specified

FFMPEG - cut video result in longer cut

I'm trying to cut the last 8 seconds of a video I got; the problem is that ffmpeg is picking the last 10 seconds instead and I don't really know why. I checked and there is no offset between "0:00:00" and the effective start of the video, so why should it take more seconds?
this is my code:
ffmpeg.exe -ss 00:01:02 -i "F:\temp\input.mp4" -c copy -t 00:00:08 "D:\temp\1_output.mp4"
this is the output:
ffmpeg version N-90893-gcae6f806a6 Copyright (c) 2000-2018 the FFmpeg
developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl
--enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth libavutil 56. 17.100 / 56. 17.100 libavcodec 58. 19.100 / 58. 19.100 libavformat 58. 13.100 / 58. 13.100 libavdevice 58. 4.100 /
4.100 libavfilter 7. 21.100 / 7. 21.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 Input #0,
mov,mp4,m4a,3gp,3g2,mj2, from 'F:\temp\input.mp4': Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.13.100 Duration: 00:01:10.34, start: 0.000000, bitrate: 14542 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 576x1024, 14346 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 193 kb/s (default)
Metadata:
handler_name : SoundHandler Output #0, mp4, to 'D:\temp\1_output.mp4': Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.13.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 576x1024, q=2-31, 14346 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc
(default)
Metadata:
handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 193 kb/s (default)
Metadata:
handler_name : SoundHandler Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 252
fps=0.0 q=-1.0 Lsize= 3089kB time=00:00:07.99 bitrate=3164.7kbits/s
speed=1e+003x video:2841kB audio:240kB subtitle:0kB other
streams:0kB global headers:0kB muxing overhead: 0.283155%
I don't really understand what i'm doing wrong
Thanks
do not use "-c copy" it sucks up everything.
just try like this and you are good to go...
ffmpeg.exe -i "F:\temp\input.mp4" -ss 00:01:02 -to 00:01:10 "D:\temp\1_output.mp4"

Resources