Make Atmos content work more like other content. Now its MXFs
[dcpomatic.git] / src / lib / ffmpeg_file_encoder.cc
index 7bac7b1302bb1860218386a559b1eb8658bf0506..44ef3f0726d6be3d5b71e0046b1389e8f4e7641d 100644 (file)
@@ -130,8 +130,9 @@ FFmpegFileEncoder::FFmpegFileEncoder (
                throw runtime_error (String::compose ("could not open FFmpeg audio codec (%1)", buffer));
        }
 
-       if (avio_open_boost (&_format_context->pb, _output, AVIO_FLAG_WRITE) < 0) {
-               throw runtime_error ("could not open FFmpeg output file");
+       r = avio_open_boost (&_format_context->pb, _output, AVIO_FLAG_WRITE);
+       if (r < 0) {
+               throw runtime_error (String::compose("could not open FFmpeg output file %1 (%2)", _output.string(), r));
        }
 
        AVDictionary* options = 0;
@@ -393,7 +394,8 @@ FFmpegFileEncoder::audio_frame (int size)
                DCPOMATIC_ASSERT (false);
        }
 
-       frame->pts = _audio_frames / (av_q2d (_audio_stream->time_base) * _audio_frame_rate);
+       DCPOMATIC_ASSERT (_audio_stream->time_base.num == 1);
+       frame->pts = _audio_frames * _audio_stream->time_base.den / _audio_frame_rate;
 
        AVPacket packet;
        av_init_packet (&packet);