Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#4875 closed defect (fixed)

Last frame of low-fps vfr mov input file duplicated 40000 times

Reported by: maxvgi Owned by:
Priority: important Component: ffmpeg
Version: git-master Keywords: mov fps regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I try to convert video to mp4 with libx264, but ffmpeg hangs up at the end of convertion process.

Nevertheless ffmpeg successfully converts the sample to avi or saves to mp4 without convertion (using -vcodec copy).

How to reproduce:

% ffmpeg -y -i ./hang_up_during_conversion_to_mp4.mp4 -vcodec libx264 -an out.mp4

The input video file was saved from ip-camera RTSP stream with ffmpeg using -vcodec copy -an -f segment

I can assert that the problem does not persist at version N-67586-g3e1ac10, but persists in N-73635-gfd4c87f and later.

I can upload the sample video if needed.

Attachments (3)

ffmpeg-20150923-143021.log (178.1 KB) - added by maxvgi 4 years ago.
ffmpeg-20150923-160305.log (10.5 KB) - added by maxvgi 4 years ago.
console_output.log (97.4 KB) - added by maxvgi 4 years ago.

Download all attachments as: .zip

Change History (14)

Changed 4 years ago by maxvgi

comment:1 Changed 4 years ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords deadlock regression added
  • Priority changed from normal to important

To make this a valid ticket, please test current FFmpeg git head, upload the input sample and provide the command line that allows to reproduce the issue together with the complete, uncut console output.
Is the issue only reproducible with -vcodec libx264 or also with -vcodec mpeg4 -qscale 2?

comment:2 Changed 4 years ago by cehoyos

And, even more important, please provide a backtrace with gdb when FFmpeg hangs.

Changed 4 years ago by maxvgi

Changed 4 years ago by maxvgi

comment:3 Changed 4 years ago by maxvgi

I have compiled current sources from git.

-vcodec mpeg4 -qscale 2 leads to the same problem.

I have uploaded the sample video to ftp://upload.ffmpeg.org/incoming/hang_up_during_convertion_to_mp4.mp4

Fresh ffmpeg reports and console output are attached.

gdb backtrace:

#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007ffff6568373 in ?? () from /usr/local-2015-09-23/lib/libavcodec.so.57
#2  0x00007ffff6509ce2 in ?? () from /usr/local-2015-09-23/lib/libavcodec.so.57
#3  0x00007ffff665d78c in avcodec_encode_video2 () from /usr/local-2015-09-23/lib/libavcodec.so.57
#4  0x000000000041fac6 in do_video_out (s=0x63ae00, ost=ost@entry=0x63b940, next_picture=next_picture@entry=0x1f348c0, sync_ipts=<optimized out>) at ffmpeg.c:1191
#5  0x0000000000420dc6 in reap_filters (flush=0, flush@entry=6535488) at ffmpeg.c:1382
#6  0x0000000000426c7a in transcode_step () at ffmpeg.c:3931
#7  transcode () at ffmpeg.c:3974
#8  0x0000000000408bf8 in main (argc=<optimized out>, argv=0x7fffffffead8) at ffmpeg.c:4157

Use the following command to reproduce the bug:

ffmpeg -i hang_up_during_convertion_to_mp4.mp4 -vcodec mpeg4 -qscale 2 out.mp4

comment:4 Changed 4 years ago by cehoyos

Please recompile without --enable-shared to make the backtrace useful.

comment:5 Changed 4 years ago by cehoyos

  • Component changed from undetermined to ffmpeg
  • Keywords mov fps added; deadlock removed
  • Summary changed from Hangs up during convertion with libx264 to mp4 container to Last frame of low-fps vfr mov input file duplicated 40000 times

Do you know how the input file was created? The used muxer is known not to support variable frame rate correctly but the file has variable frame rate afaict...

If there is an issue, it is a regression since c5092025901b37aa5de4f290afb61fc5377eb79d related to ticket #3052 and ticket #4650.

$ ffmpeg -vsync cfr -i hang_up_during_convertion_to_mp4.mp4 -f null -
ffmpeg version N-75495-g3441fef Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      55.  2.100 / 55.  2.100
  libavcodec     57.  3.100 / 57.  3.100
  libavformat    57.  2.100 / 57.  2.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6.  8.100 /  6.  8.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hang_up_during_convertion_to_mp4.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : "186 stream"
    encoder         : Lavf56.12.103
  Duration: 00:00:29.96, start: 46020.680000, bitrate: 728 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080, 727 kb/s, 10.01 fps, 25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      handler_name    : VideoHandler
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : "186 stream"
    encoder         : Lavf57.2.100
    Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.3.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[null @ 0x2b7ee20] Encoder did not produce proper pts, making some up.
frame=43278 fps=0.0 q=-0.0 Lsize=N/A time=00:28:51.12 bitrate=N/A dup=42978 drop=0
video:4057kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Last edited 4 years ago by cehoyos (previous) (diff)

comment:6 follow-up: Changed 4 years ago by maxvgi

The input file was created from ip-camera with

ffmpeg -rtsp_transport tcp -stimeout 30000000 -i rtsp://.... -copytb -1 -vcodec copy -an -map 0:0 -f segment -segment_time 30 -segment_format mp4 out_%d.mp4

My camera output stream options allow setting only fixed fps, but some frames where possibly lost during network transmission or by camera hardware.

comment:7 in reply to: ↑ 6 Changed 4 years ago by cehoyos

Replying to maxvgi:

The input file was created from ip-camera with

ffmpeg -rtsp_transport tcp -stimeout 30000000 -i rtsp://.... -copytb -1 -vcodec copy -an -map 0:0 -f segment -segment_time 30 -segment_format mp4 out_%d.mp4

The following might be a workaround:

$ ffmpeg -rtsp_transport tcp -stimeout 30000000 -i rtsp://... -vcodec copy -map 0:v:0 -f segment -segment_time 30 -segement_format rawvideo out_%d.h264

The output files probably play with a wrong speed, this must be overwritten:

$ ffmpeg -r 10 -i out_1.h264 out.mp4

My camera output stream options allow setting only fixed fps, but some frames where possibly lost during network transmission or by camera hardware.

Maybe I am wrong and the file you provided is cfr.

comment:8 Changed 4 years ago by maxvgi

Thank you. Now I simply use on old version of ffmpeg for this operation.

Should I provide some more information or do some tests for this issue?

comment:9 follow-up: Changed 4 years ago by michael

I fail to reproduce this
i get just dup=449 here
is this still reproduceable?

comment:10 Changed 4 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed

This is not reproducible since b01891a9f08b9d271d75d179b3138242a958ee04

comment:11 in reply to: ↑ 9 Changed 4 years ago by maxvgi

Replying to michael:

I fail to reproduce this

Yes, the bug is no more reproducable. Fixed.

Note: See TracTickets for help on using tickets.