Re: [FFmpeg-user] splitting and concatenating file results in a different file

2019-11-05 Thread Carl Eugen Hoyos
Am Do., 31. Okt. 2019 um 19:15 Uhr schrieb Jon Beyer :

> ffmpeg -i concat.mp4 video2/frames_%05d.jpg
>
> ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers

Unrelated:
Please understand that only current FFmpeg git head is supported here
and that there is absolutely no release support for macos.

>   built with Apple clang version 11.0.0 (clang-1100.0.33.8)
>   configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_1 --enable-shared
> --enable-pthreads --enable-version3 --enable-avresample --cc=clang
> --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include
> -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin
> -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls
> --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame
> --enable-libopus --enable-librubberband --enable-libsnappy
> --enable-libtesseract --enable-libtheora --enable-libvidstab
> --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
> --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype
> --enable-frei0r --enable-libass --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp
> --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack
> --disable-indev=jack
>   libavutil  56. 31.100 / 56. 31.100
>   libavcodec 58. 54.100 / 58. 54.100
>   libavformat58. 29.100 / 58. 29.100
>   libavdevice58.  8.100 / 58.  8.100
>   libavfilter 7. 57.100 /  7. 57.100
>   libavresample   4.  0.  0 /  4.  0.  0
>   libswscale  5.  5.100 /  5.  5.100
>   libswresample   3.  5.100 /  3.  5.100
>   libpostproc55.  5.100 / 55.  5.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'concat.mp4':
>   Metadata:
> major_brand : isom
> minor_version   : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf58.29.100
>   Duration: 00:02:15.94, start: 0.00, bitrate: 5037 kb/s
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
> 1280x720 [SAR 1:1 DAR 16:9], 4903 kb/s, 29.98 fps, 30 tbr, 15360 tbn, 60
> tbc (default)
> Metadata:
>   handler_name: VideoHandler
> Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
> stereo, fltp, 128 kb/s (default)
> Metadata:
>   handler_name: SoundHandler
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
> Press [q] to stop, [?] for help
> [swscaler @ 0x10ecd7000] deprecated pixel format used, make sure you did
> set range correctly
> Output #0, image2, to 'video2/frames_%05d.jpg':
>   Metadata:
> major_brand : isom
> minor_version   : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf58.29.100
> Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 1280x720 [SAR 1:1 DAR
> 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
> Metadata:
>   handler_name: VideoHandler
>   encoder : Lavc58.54.100 mjpeg
> Side data:
>   cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: -1

> frame= 4076 fps= 73 q=24.8 Lsize=N/A time=00:02:15.86 bitrate=N/A dup=3
> drop=0 speed=2.44x

This indicates three frames were duplicated.

> video:97160kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: unknown

You can avoid the duplication with -vsync 0 at the cost of likely A/V desync.

Carl Eugen
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] splitting and concatenating file results in a different file

2019-10-31 Thread Jon Beyer
A bit more information on this issue, after created the concatenated file
with the following commands [1] and [2], pasted at bottom, if I
print pkt_pts_time via ffprobe with commands [3] and [4], I see that the
timestamp of frame 302 is what is throwing things off when I compare the
two list of frames:

frames_input:
...
300:frame,9.97,P
301:frame,10.00,P
302:frame,*10.03*,I
303:frame,10.07,B
...

frames_concat:
...
300:frame,9.97,P
301:frame,10.00,P
302:frame,*10.083008*,I
303:frame,10.116341,B
...


[1] ffmpeg -i input.mp4 -map 0 -c copy -f segment -segment_time 10
chunk_%03d.mp4
[2] ffmpeg -f concat -safe 0 -i mylist.txt -c copy concat.mp4
[3] ffprobe -select_streams v -show_entries frame=pict_type,pkt_pts_time
-of csv input.mp4 | grep -n frame > frames_input
[4] ffprobe -hide_banner -select_streams v -show_entries
frame=pict_type,pkt_pts_time -of csv concat.mp4 | grep -n frame >
frames_concat
[5] diff frames_input frames_concat
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] splitting and concatenating file results in a different file

2019-10-31 Thread Jon Beyer
Thanks Carl, here is the full output from each of those commands.  Nothing
unusual that I can see.  I have truncated the diff output, because the
output is superfluous after those three frames are inserted after
chunk_000.mp4.  I'll point out that the second-to-last line of the concat
filter command appears to properly show 4,073 frames, but then when
converting to .jpg, 4,076 frames are produced.



ffmpeg -i input.mp4 -map 0 -c copy -f segment -segment_time 10
chunk_%03d.mp4

ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.8)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_1 --enable-shared
--enable-pthreads --enable-version3 --enable-avresample --cc=clang
--host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include
-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin
-fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls
--enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame
--enable-libopus --enable-librubberband --enable-libsnappy
--enable-libtesseract --enable-libtheora --enable-libvidstab
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
--enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype
--enable-frei0r --enable-libass --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp
--enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack
--disable-indev=jack
  libavutil  56. 31.100 / 56. 31.100
  libavcodec 58. 54.100 / 58. 54.100
  libavformat58. 29.100 / 58. 29.100
  libavdevice58.  8.100 / 58.  8.100
  libavfilter 7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale  5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
major_brand : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
  Duration: 00:02:15.84, start: 0.00, bitrate: 5041 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 4906 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
(default)
Metadata:
  handler_name: VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 128 kb/s (default)
Metadata:
  handler_name: SoundHandler
[segment @ 0x7fb231815800] Opening 'chunk_000.mp4' for writing
Output #0, segment, to 'chunk_%03d.mp4':
  Metadata:
major_brand : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], q=2-31, 4906 kb/s, 30 fps, 30 tbr, 15360 tbn,
30 tbc (default)
Metadata:
  handler_name: VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 128 kb/s (default)
Metadata:
  handler_name: SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[segment @ 0x7fb231815800] Opening 'chunk_001.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_002.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_003.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_004.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_005.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_006.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_007.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_008.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_009.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_010.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_011.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_012.mp4' for writing
[segment @ 0x7fb231815800] Opening 'chunk_013.mp4' for writing/A speed= 245x
frame= 4073 fps=0.0 q=-1.0 Lsize=N/A time=00:02:15.81 bitrate=N/A speed=
258x
video:81321kB audio:2137kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown


ffmpeg -f concat -safe 0 -i mylist.txt -c copy concat.mp4

ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.8)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_1 --enable-shared
--enable-pthreads --enable-version3 --enable-avresample --cc=clang
--host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include
-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin
-fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls
--enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame
--enable-libopus --enable-librubberband --enable-libsnappy
--enable-libtesseract 

Re: [FFmpeg-user] splitting and concatenating file results in a different file

2019-10-31 Thread Jon Beyer
Let me correct me previous statement slightly.  It would appear that there
aren't three frames inserted at the beginning of chunk_001.mp4 in
concat.mp4.  There is one frame inserted there, that causes an off-by-one
error, and then I would imagine that the second and third superfluous
frames are inserted at the beginning of different chunks.  There are 14
chunks in all, so it isn't an extra frame at each chunk, as there are only
three extra frames in the concatenated file.

Thanks again,
Jon




On Thu, Oct 31, 2019 at 1:22 PM Jon Beyer  wrote:

> Thanks Carl, here is the full output from each of those commands.  Nothing
> unusual that I can see.  I have truncated the diff output, because the
> output is superfluous after those three frames are inserted after
> chunk_000.mp4.  I'll point out that the second-to-last line of the concat
> filter command appears to properly show 4,073 frames, but then when
> converting to .jpg, 4,076 frames are produced.
>
>
>
> ffmpeg -i input.mp4 -map 0 -c copy -f segment -segment_time 10
> chunk_%03d.mp4
>
> ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
>   built with Apple clang version 11.0.0 (clang-1100.0.33.8)
>   configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_1 --enable-shared
> --enable-pthreads --enable-version3 --enable-avresample --cc=clang
> --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include
> -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin
> -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls
> --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame
> --enable-libopus --enable-librubberband --enable-libsnappy
> --enable-libtesseract --enable-libtheora --enable-libvidstab
> --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
> --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype
> --enable-frei0r --enable-libass --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp
> --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack
> --disable-indev=jack
>   libavutil  56. 31.100 / 56. 31.100
>   libavcodec 58. 54.100 / 58. 54.100
>   libavformat58. 29.100 / 58. 29.100
>   libavdevice58.  8.100 / 58.  8.100
>   libavfilter 7. 57.100 /  7. 57.100
>   libavresample   4.  0.  0 /  4.  0.  0
>   libswscale  5.  5.100 /  5.  5.100
>   libswresample   3.  5.100 /  3.  5.100
>   libpostproc55.  5.100 / 55.  5.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
>   Metadata:
> major_brand : isom
> minor_version   : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf56.40.101
>   Duration: 00:02:15.84, start: 0.00, bitrate: 5041 kb/s
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
> 1280x720 [SAR 1:1 DAR 16:9], 4906 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
> (default)
> Metadata:
>   handler_name: VideoHandler
> Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
> stereo, fltp, 128 kb/s (default)
> Metadata:
>   handler_name: SoundHandler
> [segment @ 0x7fb231815800] Opening 'chunk_000.mp4' for writing
> Output #0, segment, to 'chunk_%03d.mp4':
>   Metadata:
> major_brand : isom
> minor_version   : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf58.29.100
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
> 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 4906 kb/s, 30 fps, 30 tbr, 15360 tbn,
> 30 tbc (default)
> Metadata:
>   handler_name: VideoHandler
> Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
> stereo, fltp, 128 kb/s (default)
> Metadata:
>   handler_name: SoundHandler
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
>   Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> [segment @ 0x7fb231815800] Opening 'chunk_001.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_002.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_003.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_004.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_005.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_006.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_007.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_008.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_009.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_010.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_011.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_012.mp4' for writing
> [segment @ 0x7fb231815800] Opening 'chunk_013.mp4' for writing/A speed=
> 245x
> frame= 4073 fps=0.0 q=-1.0 Lsize=N/A time=00:02:15.81 bitrate=N/A speed=
> 258x
> video:81321kB audio:2137kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: unknown
>
>
> 

Re: [FFmpeg-user] splitting and concatenating file results in a different file

2019-10-31 Thread Carl Eugen Hoyos


> Am 31.10.2019 um 14:55 schrieb Jon Beyer :
> 
> I'm trying to understand the basics of splitting a file on I frames and
> then concatenating the smaller files back together.

The fundamentals are that ffmpeg is a transcoding application, not a file 
archiver.
Your command lines should provide identical output for some input files, but 
without the command lines you tested posted together with the complete, uncut 
console output there is not much we can say (or guess).

Carl Eugen
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-user] splitting and concatenating file results in a different file

2019-10-31 Thread Jon Beyer
I'm trying to understand the basics of splitting a file on I frames and
then concatenating the smaller files back together.  I am using the
commands below to split a basic .mp4 file with the "-f segment" option, and
then I use "-f concat" to join them.  I then extract all frames from the
file as .jpg files and compare the results.  The concatenated version has
three extra frames that seem to appear at what would be the start of the
second chunk.  Any idea what is going on here, and how to correct it?

Thanks in advance!

ffmpeg -i input.mp4 -map 0 -c copy -f segment -segment_time 10
chunk_%03d.mp4

ffmpeg -f concat -safe 0 -i mylist.txt -c copy concat.mp4

ffmpeg -i input.mp4 video1/frames_%05d.jpg
ffmpeg -i concat.mp4 video2/frames_%05d.jpg

diff -r video1/ video2/
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".