I have a video of just under an hour recorded but it appears to be damaged somehow. The file format is h264 MP4 and the file size is 2.3 GB, so I'm confident that the information is there, just that the file format is damaged. How could I approach fixing it?
So far, I've tried a simple ffmpeg copy operation:
>ffmpeg -i video_28_07_2015_15_16_05.mp4 -c copy out.mp4
ffmpeg version N-73895-g323ec6b Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libdcadec --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
libavutil 54. 28.100 / 54. 28.100
libavcodec 56. 50.101 / 56. 50.101
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 25.100 / 5. 25.100
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0x2a78e00] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
video_28_07_2015_15_16_05.mp4: could not find codec parameters
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video_28_07_2015_15_16_05.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2015-07-28 14:12:50
Duration: 00:56:43.53, bitrate: 5345 kb/s
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 1280x720, SAR 1:1 DAR 16:9, 30 fps, 90k tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2015-07-28 14:12:50
handler_name : VideoHandle
[mp4 # 0x2a7b260] Codec for stream 0 does not use global headers but container format requires global headers
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
encoder : Lavf56.40.101
Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), none, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 90k tbr, 90k tbn, 90k tbc (default)
Metadata:
creation_time : 2015-07-28 14:12:50
handler_name : VideoHandle
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
I have no idea of what to try next and would appreciate suggestions and guidance.
Ok, so untrunc by Federico Ponchio worked. The procedure (on Ubuntu 14.04 LTS) was as follows:
sudo apt-get -y install libavformat-dev libavcodec-dev libavutil-dev
wget https://github.com/ponchio/untrunc/archive/master.zip
unzip master.zip
cd untrunc-master
g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil
./untrunc video_12_02_2015_15_02_58.mp4 video_28_07_2015_15_16_05.mp4
The first argument is an example working video from the same device and the second argument is the broken video. The program ran for a short time and a new working file called video_28_07_2015_15_16_05.mp4_fixed.mp4 was created.
Try to use my project: https://github.com/bookkojot/mp4fixer
Similar to untruc, it requires reference file.
Seems that Federico Ponchio made his untrunc available for everybody (non-Linux users also ;-) ): untrunc.it
Related
I have a problem with some mp3 files. When transcoding the file with FFMPEG I get the following error:
[mp3float # 0x7fd42f813200] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
Is this a problem of the file itself, and how it is produced?
Or is it a problem of FFMPEG?
Here full decoding message:
ffmpeg version git-2020-07-28-dfd12ee Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.16)
configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-dfd12ee_2 --enable-shared --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libaom --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-demuxer=dash --disable-libjack --disable-indev=jack --enable-opencl --enable-videotoolbox --disable-htmlpages --enable-libfdk-aac --enable-nonfree
libavutil 56. 57.100 / 56. 57.100
libavcodec 58. 97.102 / 58. 97.102
libavformat 58. 49.100 / 58. 49.100
libavdevice 58. 11.101 / 58. 11.101
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
[mp3 # 0x7fd42f808200] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'Ice Mc - Think About The Way.mp3':
Metadata:
title : Think About The Way
TBPM : 133
artist : Ice MC
date : 1994
track : 4/15
disc : 0
album_artist : ICE MC
Duration: 00:04:16.39, start: 0.000000, bitrate: 323 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 600x592 [SAR 72:72 DAR 75:74], 90k tbr, 90k tbn, 90k tbc (attached pic)
Metadata:
comment : Other
Stream mapping:
Stream #0:1 -> #0:0 (mjpeg (native) -> wrapped_avframe (native))
Stream #0:0 -> #0:1 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
Metadata:
title : Think About The Way
TBPM : 133
artist : Ice MC
date : 1994
track : 4/15
disc : 0
album_artist : ICE MC
encoder : Lavf58.49.100
Stream #0:0: Video: wrapped_avframe, yuvj420p(progressive), 600x592 [SAR 72:72 DAR 75:74], q=2-31, 200 kb/s, 90k fps, 90k tbn, 90k tbc (attached pic)
Metadata:
comment : Other
encoder : Lavc58.97.102 wrapped_avframe
Stream #0:1: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Metadata:
encoder : Lavc58.97.102 pcm_s16le
[mp3float # 0x7fd42f813200] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
frame= 1 fps=0.0 q=-0.0 Lsize=N/A time=00:04:16.60 bitrate=N/A speed= 725x
video:1kB audio:44204kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
What is also noticed is that this mp3 has the cover embedded as a video stream. And there is also this weird cross mapping. Not sure if that is normal?
Are you sure, that you use only the stream you need? If no, you can check it by printing all the stream number of packets, returned by av_read_frame.
To select a specific stream, you should discard others. Check this thread to find out how: How to change stream index in libavformat
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
According to the FFmpeg documentation over here, I can change frame rate of a video using:
ffmpeg -i input.mkv -c:v copy -vsync drop -r 59.94 output.mkv
but all I am getting is an av_interleaved_write_frame(): Invalid argument error on my machine. What am I doing wrong?
Here is the log:
ffmpeg -i noaudio.mp4 -c:v copy -vsync drop -r 160 lapse.mp4
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
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
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'noaudio.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:12:31.45, start: 0.000000, bitrate: 59950 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 59948 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
File 'lapse.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'lapse.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 59948 kb/s, 29.97 fps, 29.97 tbr, 10240 tbn, 160 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 # 0x7fec5400e000] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
av_interleaved_write_frame(): Invalid argument
frame= 1 fps=0.0 q=-1.0 Lsize= 0kB time=-577014:32:22.77 bitrate=N/A speed=N/A
video:794kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
You cannot change the frame-rate without re-encoding the video file, so -c:v copy won´t work. Try to use -c:v libx264 -b:v -r 59.94 and any other option you may need.
I'm trying to capture a screenshot from a udp stream using ffmpeg in a Ubuntu 14.04 System.
Following is the command
ffmpeg -y -i udp_ip -vframes 1 -q:v 1 test.png
But the image captured is of very poor resolution and I observed a lag while taking the screenshot.
Please suggest a best tool or a way to take a screenshot in the fastest way and also of the best image resolution possible.
edit:
log files
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[mpeg2video # 0x390cc60] Invalid frame dimensions 0x0.
Last message repeated 7 times
Input #0, mpegts, from 'udp://#xxx.xx.xx.xx:xxxx':
Duration: N/A, start: 144.130744, bitrate: 4128 kb/s
Program 1
Metadata:
service_name : Program-1
service_provider: Encoder
Stream #0:0[0x42]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 16:15 DAR 4:3], 4000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x43]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'player.png':
Metadata:
encoder : Lavf57.71.100
Stream #0:0: Video: png, rgb24, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc57.89.100 png
frame= 1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A dup=1 drop=1 speed=0.729x
video:777kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Since, this seems to be an issue of aspect ratio, and not quality, per se, use
ffmpeg -y -i udp_ip -vf scale=iw*sar:ih,setsar=1 -vframes 1 -q:v 1 test.png
The scale filter rescales the video to square pixels. The SAR filter isn't strictly necessary but in case the PNG muxer writes that data, better to reset it.
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)