Hello dear friends,
I'm bugfixing a tool, that among other things allows to play and cut mpeg videos, the cutting is performed using ffmpeg. I have a number of test videos that can be divided in good and bad ones. The good ones dont do any troubles when displaying or cutting. The bad ones can be played (tried ffplay, vlc and wmp), but when cutting them with ffmpeg, the resulting videos show all kinds of errors - from remaining black while playing to cannot being opened at all. Yet VLC can cut those bad videos just fine and the results are fine videos by the themselves.
The cutting is happening with the following ffmpeg command: ffmpeg -nostdin -y -loglevel info -i in.mpeg -ss h:MM: ss -to h:MM: ss -vcodec copy -copyts out.mpeg
Also let me add that I'm very new to video stuff, so I dont always understand what I'm doing.
What I have tried so far:
- I have tried various combinations of ffmpeg arguments (-ss / -to / -c:v libx264 and many more in different orders). None of the arguments and combinations have provided good cutting results.
- I have used ffprobe on the bad videos and cutting results. Here i found some interesting hints. All the bad videos have only one stream (0:0) while the good ones have two to three streams. Also "ffprobe video.mpg -show_format" says for bad videos "nb_streams=1 ...format_name=mpegvideo format_long_name=raw MPEG video..." and for the good videos "nb_streams=2...format_name=mpeg format_long_name=MPEG-PS (MPEG-2 Program Stream)"
- I have tried some other tools like VLC, windows media player and MediaInfo. VLC is cutting realy awsome. Its cutting results can be played just perfect with any other player.
My question:
- Do you know of ffmpeg cutting arguments that allow to obtain same perfect results as VLC?
- Can you tell me why my bad videos are causing the troubles? What makes them worse than the good ones?
I will gladly provide you with further info.
Thanks in advance.
+ Reply to Thread
Results 1 to 17 of 17
-
Last edited by mpegnup; 3rd Apr 2020 at 02:29.
-
Try ffmpeg.exe -y -i in.mpeg -ss HH:MM:SS -to HH:MM:SS -c:v copy -c:a copy out.mpg
Last edited by ProWo; 3rd Apr 2020 at 03:27.
-
Many thank for the quick response ProWo. Here are the results:
C:\Folder>ffplay.exe in.mpg
ffplay version git-2020-04-01-afa5e38 Copyright (c) 2003-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200328
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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 77.101 / 58. 77.101
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.101 / 7. 77.101
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mpegvideo @ 0000020d3de18fc0] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegvideo, from 'in.mpg':
Duration: 00:01:04.12, bitrate: 4000 kb/s
Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], 4000 kb/s, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Side data:
cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A
4.49 M-V: 0.000 fd= 0 aq= 0KB vq= 503KB sq= 0B f=0/0
<in.mpeg is played>
C:\Folder>ffmpeg.exe -y -i in.mpg -ss 0:00:05 -to 0:00:25 -c:v copy -c:a copy out.mpg
ffmpeg version git-2020-04-01-afa5e38 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200328
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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 77.101 / 58. 77.101
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.101 / 7. 77.101
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mpegvideo @ 00000248ae2eb900] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegvideo, from 'in.mpg':
Duration: 00:01:04.12, bitrate: 4000 kb/s
Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], 4000 kb/s, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Side data:
cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A
Output #0, mpeg, to 'out.mpg':
Metadata:
encoder : Lavf58.42.100
Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], q=2-31, 4000 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc
Side data:
cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mpeg @ 00000248ae2f43c0] 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
frame= 495 fps=0.0 q=-1.0 Lsize= 9700kB time=00:00:19.96 bitrate=3981.1kbits/s speed=1.25e+03x
video:9662kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.392299%
C:\Folder>ffplay.exe out.mpg
ffplay version git-2020-04-01-afa5e38 Copyright (c) 2003-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200328
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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 77.101 / 58. 77.101
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.101 / 7. 77.101
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mpeg @ 000001c4be1c9080] probed stream 0 failedB sq= 0B f=0/0
[mpeg @ 000001c4be1c9080] Could not find codec parameters for stream 0 (Video: none, none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpeg, from 'out.mpg':
Duration: 00:00:19.76, start: 0.540000, bitrate: 4021 kb/s
Stream #0:0[0x1e0]: Video: none, none, 25 tbr, 90k tbnB f=0/0
No decoder could be found for codec none
Failed to open file 'out.mpg' or configure filtergraph
<out.mpeg is not played> -
Try first without cutting (for test only): ffmpeg.exe -y -i in.mpeg -c:v copy -c:a copy out.mpg. The output can be played?
-
The non-cutted output is played.
C:\Folder>ffmpeg.exe -y -i in.mpg -c:v copy -c:a copy out.mpg
ffmpeg version git-2020-04-01-afa5e38 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200328
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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 77.101 / 58. 77.101
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.101 / 7. 77.101
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mpegvideo @ 00000247c588b800] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegvideo, from 'in.mpg':
Duration: 00:01:04.12, bitrate: 4000 kb/s
Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], 4000 kb/s, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Side data:
cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A
Output #0, mpeg, to 'out.mpg':
Metadata:
encoder : Lavf58.42.100
Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], q=2-31, 4000 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc
Side data:
cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mpeg @ 00000247c5894280] 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
frame= 1601 fps=0.0 q=-1.0 Lsize= 31428kB time=00:01:04.00 bitrate=4022.8kbits/s speed=1.49e+03x
video:31309kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.381037%
C:\Folder>ffplay.exe out.mpg
ffplay version git-2020-04-01-afa5e38 Copyright (c) 2003-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200328
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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 77.101 / 58. 77.101
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.101 / 7. 77.101
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, mpeg, from 'out.mpg': 0KB vq= 0KB sq= 0B f=0/0
Duration: 00:01:03.92, start: 0.580000, bitrate: 4027 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], 4000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Side data:
cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A
3.07 M-V: 0.000 fd= 0 aq= 0KB vq= 482KB sq= 0B f=0/0
<out.mpg is played> -
Then try ffmpeg.exe -y -fflags +genpts -i in.mpeg -ss HH:MM:SS -to HH:MM:SS -c:v copy -c:a copy out.mpg
-
out.mpg is not playing
Code:C:\Folder>ffmpeg.exe -y -fflags +genpts -i in.mpg -ss 00:00:05 -to 00:00:20 -c:v copy -c:a copy out.mpg ffmpeg version git-2020-04-01-afa5e38 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9.3.1 (GCC) 20200328 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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 42.102 / 56. 42.102 libavcodec 58. 77.101 / 58. 77.101 libavformat 58. 42.100 / 58. 42.100 libavdevice 58. 9.103 / 58. 9.103 libavfilter 7. 77.101 / 7. 77.101 libswscale 5. 6.101 / 5. 6.101 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 [mpegvideo @ 00000187199dbf40] Estimating duration from bitrate, this may be inaccurate Input #0, mpegvideo, from 'in.mpg': Duration: 00:01:04.12, bitrate: 4000 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], 4000 kb/s, 25 fps, 25 tbr, 1200k tbn, 50 tbc Side data: cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A Output #0, mpeg, to 'out.mpg': Metadata: encoder : Lavf58.42.100 Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], q=2-31, 4000 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc Side data: cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help frame= 370 fps=0.0 q=-1.0 Lsize= 7258kB time=00:00:14.96 bitrate=3974.4kbits/s speed=1.07e+03x video:7228kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.418553% C:\Folder>ffplay.exe out.mpg ffplay version git-2020-04-01-afa5e38 Copyright (c) 2003-2020 the FFmpeg developers built with gcc 9.3.1 (GCC) 20200328 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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 42.102 / 56. 42.102 libavcodec 58. 77.101 / 58. 77.101 libavformat 58. 42.100 / 58. 42.100 libavdevice 58. 9.103 / 58. 9.103 libavfilter 7. 77.101 / 7. 77.101 libswscale 5. 6.101 / 5. 6.101 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 [mpeg @ 000001cce5029080] probed stream 0 failedB sq= 0B f=0/0 [mpeg @ 000001cce5029080] Could not find codec parameters for stream 0 (Video: none, none): unknown codec Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, mpeg, from 'out.mpg': Duration: 00:00:14.80, start: 0.620000, bitrate: 4017 kb/s Stream #0:0[0x1e0]: Video: none, none, 25 fps, 25 tbr, 90k tbn No decoder could be found for codec none Failed to open file 'out.mpg' or configure filtergraph
-
OK, then try first: ffmpeg.exe -y -fflags +genpts -i in.mpeg -c:v copy -c:a copy out.mpg
second pass: ffmpeg.exe -y -fflags +genpts -i out.mpg -ss HH:MM:SS -to HH:MM:SS -c:v copy -c:a copy newout.mpg -
newout.mpg doesn't play
Code:C:\Folder>ffmpeg.exe -y -fflags +genpts -i in.mpg -c:v copy -c:a copy out.mpg ffmpeg version git-2020-04-01-afa5e38 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9.3.1 (GCC) 20200328 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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 42.102 / 56. 42.102 libavcodec 58. 77.101 / 58. 77.101 libavformat 58. 42.100 / 58. 42.100 libavdevice 58. 9.103 / 58. 9.103 libavfilter 7. 77.101 / 7. 77.101 libswscale 5. 6.101 / 5. 6.101 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 [mpegvideo @ 000001f72145ba40] Estimating duration from bitrate, this may be inaccurate Input #0, mpegvideo, from 'in.mpg': Duration: 00:01:04.12, bitrate: 4000 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], 4000 kb/s, 25 fps, 25 tbr, 1200k tbn, 50 tbc Side data: cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A Output #0, mpeg, to 'out.mpg': Metadata: encoder : Lavf58.42.100 Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], q=2-31, 4000 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc Side data: cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help frame= 1601 fps=0.0 q=-1.0 Lsize= 31432kB time=00:01:04.00 bitrate=4023.3kbits/s speed=1.28e+03x video:31309kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.393813% C:\Folder>ffmpeg.exe -y -fflags +genpts -i out.mpg -ss 00:00:05 -to 00:00:20 -c:v copy -c:a copy newout.mpg ffmpeg version git-2020-04-01-afa5e38 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9.3.1 (GCC) 20200328 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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 42.102 / 56. 42.102 libavcodec 58. 77.101 / 58. 77.101 libavformat 58. 42.100 / 58. 42.100 libavdevice 58. 9.103 / 58. 9.103 libavfilter 7. 77.101 / 7. 77.101 libswscale 5. 6.101 / 5. 6.101 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 Input #0, mpeg, from 'out.mpg': Duration: 00:01:04.04, start: 0.540000, bitrate: 4020 kb/s Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], 4000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc Side data: cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A Output #0, mpeg, to 'newout.mpg': Metadata: encoder : Lavf58.42.100 Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 352x288 [SAR 12:11 DAR 4:3], q=2-31, 4000 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc Side data: cpb: bitrate max/min/avg: 4000000/0/0 buffer size: 1835008 vbv_delay: N/A Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help frame= 371 fps=0.0 q=-1.0 Lsize= 7274kB time=00:00:14.96 bitrate=3983.2kbits/s speed=1.15e+03x video:7244kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.416329% C:\Folder>ffplay.exe newout.mpg ffplay version git-2020-04-01-afa5e38 Copyright (c) 2003-2020 the FFmpeg developers built with gcc 9.3.1 (GCC) 20200328 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-libsrt --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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 42.102 / 56. 42.102 libavcodec 58. 77.101 / 58. 77.101 libavformat 58. 42.100 / 58. 42.100 libavdevice 58. 9.103 / 58. 9.103 libavfilter 7. 77.101 / 7. 77.101 libswscale 5. 6.101 / 5. 6.101 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 [mpeg @ 0000027fb7959480] probed stream 0 failedB sq= 0B f=0/0 [mpeg @ 0000027fb7959480] Could not find codec parameters for stream 0 (Video: none, none): unknown codec Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, mpeg, from 'newout.mpg': Duration: 00:00:14.80, start: 0.620000, bitrate: 4026 kb/s Stream #0:0[0x1e0]: Video: none, none, 25 fps, 25 tbr, 90k tbn No decoder could be found for codec none Failed to open file 'newout.mpg' or configure filtergraph
-
What's about ffmpeg.exe -y -ss HH:MM:SS -i in.mpeg -to HH:MM:SS -c:v copy -na copy out.mpg?
Last edited by ProWo; 3rd Apr 2020 at 04:39.
-
-
What's about ffmpeg.exe -y -ss HH:MM:SS -i in.mpeg -to HH:MM:SS -c:v copy -na copy out.mpg?
-
I notice you arer copying your cuts. FFMpeg will cut exactly where you tell it but if you do not cut on a key frame, the results are varied just as you describe. The results are also affected by where you place your search (-ss) , as an input or as an output. Most free cutters cut at the key frames so they almost always work. The only safe way is to cut at a key frame and be aware that if you end on a 'B' frame, ffmpeg will take 2 frames to end. That means cut at Bbp (Capital B) will end at the P frame.
The only safe way is to cut at a Key frame. I use a CMD file to find the key frames and cut there. You can also use a AVIsynth script to show the Frame type as you play. Below is a sample player showing Frame types and the type of weird sequences you can get from an MPG file.
Frame.mpg
No. pts_time type
0 0.200000 1 I
1 0.240000 0 P
2 0.280000 0 P
3 0.320000 0 P
4 0.360000 0 P
5 0.400000 0 P
6 0.440000 0 P
7 0.480000 0 P
8 0.520000 0 P
9 0.560000 0 P
10 0.600000 0 B
11 0.640000 0 B
12 0.680000 1 I
[Attachment 52577 - Click to enlarge]
ALSO notice there is a 0.20000 offset for first frame so that has to be determined also and this is an open GOP (B frame Preceding I frame) So this further makes it hard to determine where to cut.
Use MediaInfo to check the type of GOP on the working ones and the non-working ones. Use FFprobe to find out what frame you are trying to cut at. -
@ProWo
What's about ffmpeg.exe -y -ss HH:MM:SS -i in.mpeg -to HH:MM:SS -c:v copy -na copy out.mpg?
Code:ffmpeg.exe -i in.mpeg -ss HH:MM:SS -to HH:MM:SS out.mpg
I'm a bit curious as I'm sure it was one of the combinations I've tried yesterday, but whatever ... at least i got my cutted chunks now.
Still thank you a lot for the ideas!
@Badman1
Yea, all this keyframe thingy can be a potential problem. Yesterday I read somewhere that curent versions of ffmpeg always takes the closest keyframe when toggled with -ss. That goes along with my personal evaluations of some cuts. I used "ffprobe video.mpeg -show_frames | findstr pict_type" to get the frame types and the few cuts I looked at, all started with an I-Frame without me taking particular of it. Also the videos have been a couple miliseconds shorter.
My problem is solved now. And once more, thanks to ProWo and Badman1!
Similar Threads
-
ffmpeg cutting: how to get negative start time?
By Luke M in forum EditingReplies: 1Last Post: 25th Jul 2018, 11:00 -
FFmpeg cutting/joining findings
By Budman1 in forum EditingReplies: 4Last Post: 11th Jul 2018, 00:25 -
other video cutting softwares? or how can it be done by ffmpeg's commands?
By sommers in forum Newbie / General discussionsReplies: 11Last Post: 9th Jun 2017, 23:41 -
Cutting a video with FFMPEG in the same format/quality?
By Unknown01 in forum Newbie / General discussionsReplies: 3Last Post: 22nd Dec 2016, 02:14 -
ffmpeg is not cutting accurately
By shuantsu in forum Newbie / General discussionsReplies: 11Last Post: 31st Jul 2015, 16:35