Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to pass the input parameter mpegts_service_id #58

Open
vandanachadha opened this issue Jan 27, 2020 · 9 comments
Open

how to pass the input parameter mpegts_service_id #58

vandanachadha opened this issue Jan 27, 2020 · 9 comments
Labels

Comments

@vandanachadha
Copy link

I need to read the input from a tuner card specific program id. In ffmpeg, the input option passed is:
-mpegts_service_id

How would I set this in the 3_transcoding.c sample?

@leandromoreira
Copy link
Owner

@vandanachadha
Copy link
Author

vandanachadha commented Jan 27, 2020

Thanks, that helped, But now, I am getting these errors:
[aac @ 0x2263c40] more samples than frame size (avcodec_encode_audio2)
[aac @ 0x2263c40] more samples than frame size (avcodec_encode_audio2)
[aac @ 0x2263c40] more samples than frame size (avcodec_encode_audio2)
[mpegts @ 0x2078cc0] PES packet size mismatch
[aac @ 0x2263c40] more samples than frame size (avcodec_encode_audio2)
[mpegts @ 0x2078cc0] PES packet size mismatch
[mpegts @ 0x2078cc0] PES packet size mismatch
[mpeg2video @ 0x2177280] ac-tex damaged at 25 7
[mpeg2video @ 0x2177280] Warning MVs not available
[mpeg2video @ 0x2177280] concealing 1035 DC, 1035 AC, 1035 MV errors in P frame
[ac3 @ 0x20ad780] incomplete frame
[aac @ 0x2263c40] more samples than frame size (avcodec_encode_audio2)
[aac @ 0x2263c40] more samples than frame size (avcodec_encode_audio2)
[mpeg @ 0x209eec0] Invalid packet stream index: 3
LOG: Error -22 while receiving packet from decoder: Invalid argument

My Streaming Parameters are:
/*

  • MPEG2 -> H264
  • AC3 -> AAC
    */
    StreamingParams sp = {0};
    sp.copy_audio = 0;
    sp.copy_video = 0;
    sp.video_codec = "libx264";
    sp.audio_codec = "aac";
    sp.codec_priv_key = "x264-params";
    sp.codec_priv_value = "keyint=60:min-keyint=60:scenecut=0:force-cfr=1";
    sp.mpegts_service_id = 22;
    sp.vcodec = "mpeg2video";

The ffmpeg equivalent which I am tryong to emulate thru 3_transcoding is:
ffmpeg -re -i /dev/dvb/adapter0/dvr0 -mpegts_service_id 22 -vcodec mpeg2video -s 720x480 -b:v 2M -minrate:v 2M -maxrate:v 2M -bufsize:v 1.4M -t 30 -f mpegts test2.mpg

@leandromoreira
Copy link
Owner

It seems that you're passing a packet for a wrong index [mpeg @ 0x209eec0] Invalid packet stream index: 3 I suposse there are only two streams

@vandanachadha
Copy link
Author

vandanachadha commented Jan 28, 2020

oh, thats because it is reading all the streams from the dvb, rather than the selected program's.

I have passed these demuxer options:
demuxer_opt_key = "mpegts_service_id";
demuxer_opt_value = "22";
to the avformat_open_input(&pFormatContext, filename, NULL, &demuxer_opts), but still get r number of programs as 2.

Is the below errors also related to the right program not being read?
[aac @ 0x187fa40] more samples than frame size (avcodec_encode_audio2)

Some more logs fyi:
Video Codec: resolution 720 x 480Audio Codec: 2 channels, sample rate 48000Audio Codec: 2 channels, sample rate 48000Video Codec: resolution 720 x 480Frame ? (40) pts -1403570077 dts -1403570077 key_frame 0 [coded_picture_number 40, display_picture_number 0]Makefile:48: recipe for target 'run_transcodingr' failed
make: *** [run_transcodingr] Error 255

@leandromoreira
Copy link
Owner

Negative PTS and DTS you maybe have to calculate them =/ (do you want to copy the audio as it is? if so mark sp.copy_audio)

@vandanachadha
Copy link
Author

vandanachadha commented Jan 28, 2020

nope, cannot copy. have to transcode from mpeg2 to h264 and from ac3 to aac. But if just transcoding, do I still need to have the filters etc set, as is the case in the init_filter etc in https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/transcoding.c#L448

Will check the negative pts, will be back with more questions I am sure :-) Thank you for your prompt responses.

@vandanachadha
Copy link
Author

The negative pts error went away once the changes to write the output to a udp stream were done. However I now get the PES packet size mismatch. What do I check for this?

Current logs:
Frame ? (145) pts 1249349192 best_effort_timestamp 1249349192, dts 1249349192 key_frame 0 [coded_picture_number 145, display_picture_number 0]Frame ? (146) pts 1249352195 best_effort_timestamp 1249352195, dts 1249352195 key_frame 0 [coded_picture_number 146, display_picture_number 0]
Frame ? (147) pts 1249355198 best_effort_timestamp 1249355198, dts 1249355198 key_frame 0 [coded_picture_number 144, display_picture_number 0]Frame ? (148) pts 1249358201 best_effort_timestamp 1249358201, dts 124
[mpegts @ 0x1d23ac0] PES packet size mismatch
[aac @ 0x2537140] more samples than frame size (avcodec_encode_audio2)
124[mpegts @ 0x1d23ac0] PES packet size mismatch
[aac @ 0x2537140] more samples than frame size (avcodec_encode_audio2)
[mpegts @ 0x1d23ac0] PES packet size mismatch
[ac3 @ 0x1d5ed00] incomplete frame
[aac @ 0x2537140] more samples than frame size (avcodec_encode_audio2)
[mpeg2video @ 0x1d5ce00] ac-tex damaged at 21 20
[mpeg2video @ 0x1d5ce00] Warning MVs not available
[mpeg2video @ 0x1d5ce00] concealing 450 DC, 450 AC, 450 MV errors in P frame
Makefile:48: recipe for target 'run_transcodingr' failed
make: *** [run_transcodingr] Error 139

@vandanachadha
Copy link
Author

vandanachadha commented Feb 5, 2020

@leandromoreira A few issues:

  1. If i set copy_audio=0 and set the audi_codec as "aac", the output steam does not contain any audio.
  2. Also sometimes, this error comes up and the output stream stops: ADTS frame size too large: 58962 (max 8191)
    Pls suggest what should be done.

@leandromoreira
Copy link
Owner

@vandanachadha sometimes you really need to tests things out to make them work I documented my walk to create the chapter 3 and even look at ffmpeg command line source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants