[FFmpeg-user] Trying to extract video stream but output only has 30 frames

William Breathitt Gray vilhelm.gray at gmail.com
Sat Apr 10 15:12:26 EEST 2021


Hello,

I have the following MP4 file:

========================================================================
========================================================================
$ ffprobe VID_20210401_150222.mp4 -hide_banner
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557a40053c00] st: 0 edit list: 1 Missing key frame while searching for timestamp: 17999835
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557a40053c00] st: 0 edit list 1 Cannot find an index entry before timestamp: 17999835.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557a40053c00] decoding for stream 0 failed
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VID_20210401_150222.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2021-04-01T06:02:45.000000Z
    com.android.version: 11
  Duration: 00:00:20.65, start: 0.000000, bitrate: 42883 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt470bg/smpte170m), 3840x2160, 42828 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2021-04-01T06:02:45.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2021-04-01T06:02:45.000000Z
      handler_name    : SoundHandle
========================================================================
========================================================================

I believe the timestamps are corrupted for this file so I would like to
salvage what I can separate the video stream from the audio. Using
ffprobe, it looks like there is an expected 616 frames:

========================================================================
========================================================================
$ ffprobe VID_20210401_150222.mp4 -hide_banner -show_streams -select_streams v:0 -count_frames 2>&1 | grep nb_
nb_frames=616
nb_read_frames=N/A
nb_read_packets=N/A
========================================================================
========================================================================

So I try to isolate the video with the following ffmpeg command:

========================================================================
========================================================================
$ ffmpeg -hide_banner -i VID_20210401_150222.mp4 -c:v copy -an onlyvideo.mp4
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x562c10dfa440] st: 0 edit list: 1 Missing key frame while searching for timestamp: 17999835
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x562c10dfa440] st: 0 edit list 1 Cannot find an index entry before timestamp: 17999835.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x562c10dfa440] decoding for stream 0 failed
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VID_20210401_150222.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2021-04-01T06:02:45.000000Z
    com.android.version: 11
  Duration: 00:00:20.65, start: 0.000000, bitrate: 42883 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt470bg/smpte170m), 3840x2160, 42828 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2021-04-01T06:02:45.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2021-04-01T06:02:45.000000Z
      handler_name    : SoundHandle
File 'onlyvideo.mp4' already exists. Overwrite? [y/N] y
Output #0, mp4, to 'onlyvideo.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 11
    encoder         : Lavf58.45.100
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt470bg/smpte170m), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 42828 kb/s, 29.97 fps, 30 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      creation_time   : 2021-04-01T06:02:45.000000Z
      handler_name    : VideoHandle
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 1, current: 0; changing to 2. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 2, current: 0; changing to 3. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 3, current: 0; changing to 4. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 4, current: 0; changing to 5. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 5, current: 0; changing to 6. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 6, current: 0; changing to 7. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 7, current: 0; changing to 8. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 8, current: 0; changing to 9. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 9, current: 0; changing to 10. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 10, current: 0; changing to 11. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 11, current: 0; changing to 12. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 12, current: 0; changing to 13. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 13, current: 0; changing to 14. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 14, current: 0; changing to 15. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 15, current: 0; changing to 16. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 16, current: 0; changing to 17. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 17, current: 0; changing to 18. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 18, current: 0; changing to 19. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 19, current: 0; changing to 20. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 20, current: 0; changing to 21. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 21, current: 0; changing to 22. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 22, current: 0; changing to 23. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 23, current: 0; changing to 24. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 24, current: 0; changing to 25. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 25, current: 0; changing to 26. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 26, current: 0; changing to 27. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 27, current: 0; changing to 28. This may result in incorrect timestamps in the output file.
[mp4 @ 0x562c10e0ce00] Non-monotonous DTS in output stream 0:0; previous: 28, current: 0; changing to 29. This may result in incorrect timestamps in the output file.
frame=   30 fps=0.0 q=-1.0 Lsize=    7948kB time=00:00:00.00 bitrate=195518967.0kbits/s speed=0.0448x
video:7946kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.016283%
========================================================================
========================================================================

The appears that the output only has 30 frames:

========================================================================
========================================================================
$ ffprobe onlyvideo.mp4 -hide_banner -show_streams -select_streams v:0 -count_frames 2>&1 | grep nb_
nb_frames=30
nb_read_frames=30
nb_read_packets=N/A
========================================================================
========================================================================

I suspect this might be due to the corrupted timestamps. How can I have
ffmpeg extract this video in the correct number of frames?

Thank you,

William Breathitt Gray
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210410/aadcf14a/attachment.sig>


More information about the ffmpeg-user mailing list