3
votes

In my current work I'm trying to encode some images to h264 video using the FFMPEG's C library. The resulting video plays fine in VLC, but has no preview image. The video can play in VLC and Mplayer on ubuntu, but won't play on Mac or PC (in fact, it causes a "VTDecoderXPCService quit unexpectedly" error on Mac).

If I run the resulting file through FFMPEG using the command line, the resulting file has a preview image, and plays correctly everywhere.

Apparently the file that I get out of the program is corrupt in some weird place, but I don't have any output during my compilation or run to indicate where. I can't share my code at the moment (work code isn't open source yet :-( ), but I have tried a number of things:

  1. Writing only header and trailer data (av_write_trailer) and no frames
  2. writing frames only minus the trailer (using avcodec_encode_video2 and av_write_frame)
  3. Adjusting our time_base and frame pts values to encode only one frame per second
  4. Removing all variable frame rate code
  5. Numerous other variants that I won't bother you with here

In creating my project, I've also followed the following tutorials:

And consulted the deprecated ffmpeg functions list

And compiled FFMPEG on ubuntu according to the official doc

And consulted numerous StackOverflow questions:

But every run of the program runs into the exact same problem.

My question is, is there anything obvious that causes a programmatic run of FFMpeg to differ from a console run (e.g., an incomplete finalization, some threading issues, etc.)? Like some obvious reason that a console run could repair a corrupted file? Or is there a decent tool/method for inspecting a video file and finding the point of corruption?

1

1 Answers

1
votes