Commit 65f5f148 authored by Antoine Cellerier's avatar Antoine Cellerier

* Fix ffmpeg muxer. (flv muxing now works with ./vlc --sout...

 * Fix ffmpeg muxer. (flv muxing now works with ./vlc  --sout "#transcode{vcodec=FLV1,acodec=mp3}:std{mux=ffmpeg{mux=flv},access=file,dst=test.flv}" -vvv --color ~/media/pinball-bit-rate-vbr-peak.wmv -I dummy) Include 2 hacks ... if someone has a better way to do it feel free to do so.
 * Remove a bunch of trailing white spaces.
parent f56fb678
...@@ -314,7 +314,7 @@ static int Demux( demux_t *p_demux ) ...@@ -314,7 +314,7 @@ static int Demux( demux_t *p_demux )
if( pkt.dts > 0 && if( pkt.dts > 0 &&
( pkt.stream_index == p_sys->i_pcr_tk || p_sys->i_pcr_tk < 0 ) ) ( pkt.stream_index == p_sys->i_pcr_tk || p_sys->i_pcr_tk < 0 ) )
{ {
p_sys->i_pcr_tk = pkt.stream_index; p_sys->i_pcr_tk = pkt.stream_index;
p_sys->i_pcr = p_frame->i_dts; p_sys->i_pcr = p_frame->i_dts;
......
...@@ -215,7 +215,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -215,7 +215,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
if( p_enc->fmt_out.i_cat == VIDEO_ES && i_cat != VIDEO_ES ) if( p_enc->fmt_out.i_cat == VIDEO_ES && i_cat != VIDEO_ES )
{ {
msg_Err( p_enc, "\"%s\" is not a video encoder", psz_namecodec ); msg_Err( p_enc, "\"%s\" is not a video encoder", psz_namecodec );
intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"), intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"),
_("\"%s\" is no video encoder."), psz_namecodec ); _("\"%s\" is no video encoder."), psz_namecodec );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -223,7 +223,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -223,7 +223,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
if( p_enc->fmt_out.i_cat == AUDIO_ES && i_cat != AUDIO_ES ) if( p_enc->fmt_out.i_cat == AUDIO_ES && i_cat != AUDIO_ES )
{ {
msg_Err( p_enc, "\"%s\" is not an audio encoder", psz_namecodec ); msg_Err( p_enc, "\"%s\" is not an audio encoder", psz_namecodec );
intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"), intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"),
_("\"%s\" is no audio encoder."), psz_namecodec ); _("\"%s\" is no audio encoder."), psz_namecodec );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -235,7 +235,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -235,7 +235,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
if( !p_codec ) if( !p_codec )
{ {
msg_Err( p_enc, "cannot find encoder %s", psz_namecodec ); msg_Err( p_enc, "cannot find encoder %s", psz_namecodec );
intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"), intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"),
_("VLC could not find encoder \"%s\"."), psz_namecodec ); _("VLC could not find encoder \"%s\"."), psz_namecodec );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -407,7 +407,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -407,7 +407,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
p_context->max_b_frames = p_context->max_b_frames =
__MAX( __MIN( p_sys->i_b_frames, FF_MAX_B_FRAMES ), 0 ); __MAX( __MIN( p_sys->i_b_frames, FF_MAX_B_FRAMES ), 0 );
p_context->b_frame_strategy = 0; p_context->b_frame_strategy = 0;
if( !p_context->max_b_frames && if( !p_context->max_b_frames &&
( p_enc->fmt_out.i_codec == VLC_FOURCC('m', 'p', '2', 'v') || ( p_enc->fmt_out.i_codec == VLC_FOURCC('m', 'p', '2', 'v') ||
p_enc->fmt_out.i_codec == VLC_FOURCC('m', 'p', '1', 'v') ) ) p_enc->fmt_out.i_codec == VLC_FOURCC('m', 'p', '1', 'v') ) )
p_context->flags |= CODEC_FLAG_LOW_DELAY; p_context->flags |= CODEC_FLAG_LOW_DELAY;
...@@ -589,7 +589,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -589,7 +589,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
{ {
vlc_mutex_unlock( lockval.p_address ); vlc_mutex_unlock( lockval.p_address );
msg_Err( p_enc, "cannot open encoder" ); msg_Err( p_enc, "cannot open encoder" );
intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"), intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"),
_("VLC could not open the encoder.") ); _("VLC could not open the encoder.") );
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -598,7 +598,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -598,7 +598,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
else else
{ {
msg_Err( p_enc, "cannot open encoder" ); msg_Err( p_enc, "cannot open encoder" );
intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"), intf_UserFatal( p_enc, VLC_FALSE, _("Streaming / Transcoding failed"),
_("VLC could not open the encoder.") ); _("VLC could not open the encoder.") );
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -784,7 +784,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict ) ...@@ -784,7 +784,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
{ {
if ( p_sys->b_trellis ) if ( p_sys->b_trellis )
p_sys->p_context->flags |= CODEC_FLAG_TRELLIS_QUANT; p_sys->p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
p_sys->p_context->noise_reduction = p_sys->p_context->noise_reduction =
p_sys->i_noise_reduction; p_sys->i_noise_reduction;
} }
......
...@@ -248,7 +248,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -248,7 +248,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
} }
codec->bit_rate = p_input->p_fmt->i_bitrate; codec->bit_rate = p_input->p_fmt->i_bitrate;
codec->codec_tag = p_input->p_fmt->i_codec; /* This is a hack */
if( i_codec_id == CODEC_ID_MP2 )
i_codec_id = CODEC_ID_MP3;
codec->codec_tag = av_codec_get_tag( p_sys->oc->oformat->codec_tag, i_codec_id );//p_input->p_fmt->i_codec;
codec->codec_id = i_codec_id; codec->codec_id = i_codec_id;
if( p_input->p_fmt->i_extra ) if( p_input->p_fmt->i_extra )
...@@ -338,6 +341,9 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -338,6 +341,9 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
pkt.dts = p_data->i_dts * p_stream->time_base.den / pkt.dts = p_data->i_dts * p_stream->time_base.den /
I64C(1000000) / p_stream->time_base.num; I64C(1000000) / p_stream->time_base.num;
/* this is another hack to prevent libavformat from triggering the "non monotone timestamps" check in avformat/utils.c */
p_stream->cur_dts = AV_NOPTS_VALUE;
if( av_write_frame( p_sys->oc, &pkt ) < 0 ) if( av_write_frame( p_sys->oc, &pkt ) < 0 )
{ {
msg_Err( p_mux, "could not write frame (pts: "I64Fd", dts: "I64Fd") " msg_Err( p_mux, "could not write frame (pts: "I64Fd", dts: "I64Fd") "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment