[FFmpeg-user] Anyone have some example c code showing how to add chapter markers to mkv
I am just finishing a playlist player, give it a list of files and it will play them out at a fixed video size with no glitches or audio messups. What i would like to do is add the name of the current playing stream so that when creating MKV files you can skip to each on as a chapter -- BR Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] Resampling of audio not working correctly
Problem: I have a video with these parameters Input #0, mpegts, from 'videoFiles/Ashbury Heights - Spiders.ts': Duration: 00:04:03.63, start: 1.368000, bitrate: 1106 kb/s Program 1 Metadata: service_name: Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 32000 Hz, stereo, fltp, 108 kb/s I have, based on the examples transcode_aac.c, initialised the resampler and this is what it is being set to init_resampler Input:3 fltp 32000, Output:3 fltp 44100 So we have a 32000 in and a 44100 out. Now running my code the video ends at 176 seconds which is 243*(32000/44100), so for some reason my write_audio_frame is not getting the right pts values. So looking into the transcode_aac.c code it has this caveat "/* * Perform a sanity check so that the number of converted samples is * not greater than the number of samples to be converted. * If the sample rates differ, this case has to be handled differently */" Can someone tell me what I need to do to get this 32000->44100 conversion working correctly. I am using the fifo as in the example but as I said i run out of audio at 148seconds. The muxer part is based on muxing.c in the way it uses the PTS to decide which packet is needed next. A bit more debug data from the audio thread Preparing videoFiles/Ashbury Heights - Spiders.ts init_resampler Input:3 fltp 32000, Output:3 fltp 44100 Output #0, matroska, to 'a.mkv': Stream #0:0: Video: h264 (Main), yuv420p, 1280x720, q=2-31, 2000 kb/s, 25 tbn Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s KEY : K pts:126000 pts_time:1.4 dts:118800 dts_time:1.32 duration:3600 duration_time:0.04 stream_index:0 A_RAW: pts:123120 pts_time:1.368dts:123120 dts_time:1.368 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:126000 pts_time:1.4 dts:126000 dts_time:1.4 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:128880 pts_time:1.432dts:128880 dts_time:1.432 duration:2880 duration_time:0.032 stream_index:1 POPped Audio 0 0.02322 POPped Audio 1024 0.02322 A_RAW: pts:131760 pts_time:1.464dts:131760 dts_time:1.464 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:134640 pts_time:1.496dts:134640 dts_time:1.496 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:137520 pts_time:1.528dts:137520 dts_time:1.528 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:140400 pts_time:1.56 dts:140400 dts_time:1.56 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:143280 pts_time:1.592dts:143280 dts_time:1.592 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:146160 pts_time:1.624dts:146160 dts_time:1.624 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:149040 pts_time:1.656dts:149040 dts_time:1.656 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:151920 pts_time:1.688dts:151920 dts_time:1.688 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:154800 pts_time:1.72 dts:154800 dts_time:1.72 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:157680 pts_time:1.752dts:157680 dts_time:1.752 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:160560 pts_time:1.784dts:160560 dts_time:1.784 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:163440 pts_time:1.816dts:163440 dts_time:1.816 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:166320 pts_time:1.848dts:166320 dts_time:1.848 duration:2880 duration_time:0.032 stream_index:1 POPped Audio 2048 0.02322 A_RAW: pts:169200 pts_time:1.88 dts:169200 dts_time:1.88 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:172080 pts_time:1.912dts:172080 dts_time:1.912 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:174960 pts_time:1.944dts:174960 dts_time:1.944 duration:2880 duration_time:0.032 stream_index:1 POPped Audio 3072 0.02322 A_RAW: pts:177840 pts_time:1.976dts:177840 dts_time:1.976 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:180720 pts_time:2.008dts:180720 dts_time:2.008 duration:2880 duration_time:0.032 stream_index:1 A_RAW: pts:183600 pts_time:2.04 dts:183600 dts_time:2.04 duration:2880 duration_time:0.032 stream_index:1 POPped Audio 4096 0.02322 POPped Audio 5120 0.02322 POPped Audio 6144 0.02322 POPped Audio 7168 0.02322 POPped Audio 8192 0.02322 POP
[FFmpeg-user] Are there any examples, using ffmpeg libs, of encoding a file where the data comes from memory
What i am trying to do is to take a full TS, and have a thread read in this stream and pass off X number of programs to different encoding threads. My current code base uses this avio_open2( &inputSource->fmt_ctx->pb, inputSource->src_filename, AVIO_FLAG_READ, &inputSource->fmt_ctx->interrupt_callback, &d); /* open input file, and allocate format context */ if (avformat_open_input(&inputSource->fmt_ctx, inputSource->src_filename, NULL, NULL) < 0) { fprintf(stderr, "%s:Could not open source file %s\n", inputSource->name, inputSource->src_filename); ret = 1; goto end; } But I have to make sure there is only one program in the stream I would like to be able to pick 3 or 4 programs from the TS and encode each seperately using my encode thread. So the question is how do I push in data which is already in the pc and is not a UDP stream or a FILE JoolzPS. Also anyone around who can help with the BUG in the examples where you CANNOT change the output audio rate, it has to be the same as the internally generated one or the example crashes. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] Are there any examples, using ffmpeg libs, of encoding a file where the data comes from memory
im not using libav-crap Joolz On Monday, 17 August 2015, 23:18, Lou wrote: On Mon, Aug 17, 2015, at 02:10 AM, JULIAN GARDNER wrote: > What i am trying to do is to take a full TS, and have a thread read in > this stream and pass off X number of programs to different encoding > threads. > My current code base uses this > avio_open2( &inputSource->fmt_ctx->pb, inputSource->src_filename, > AVIO_FLAG_READ, &inputSource->fmt_ctx->interrupt_callback, &d); > > /* open input file, and allocate format context */ > if (avformat_open_input(&inputSource->fmt_ctx, > inputSource->src_filename, NULL, NULL) < 0) { > fprintf(stderr, "%s:Could not open source file %s\n", > inputSource->name, inputSource->src_filename); > ret = 1; > goto end; > } [...] Once again, ffmpeg-user is for questions regarding the FFmpeg cli tools. Your question belongs on libav-user; the mailing list for the FFmpeg libraries. See http://ffmpeg.org/contact.html ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] Are there any examples, using ffmpeg libs, of encoding a file where the data comes from memory
sorry for that, stayed away from libav when the split happened. just seen the contact information. will repost Joolz On Monday, 17 August 2015, 23:18, Lou wrote: On Mon, Aug 17, 2015, at 02:10 AM, JULIAN GARDNER wrote: > What i am trying to do is to take a full TS, and have a thread read in > this stream and pass off X number of programs to different encoding > threads. > My current code base uses this > avio_open2( &inputSource->fmt_ctx->pb, inputSource->src_filename, > AVIO_FLAG_READ, &inputSource->fmt_ctx->interrupt_callback, &d); > > /* open input file, and allocate format context */ > if (avformat_open_input(&inputSource->fmt_ctx, > inputSource->src_filename, NULL, NULL) < 0) { > fprintf(stderr, "%s:Could not open source file %s\n", > inputSource->name, inputSource->src_filename); > ret = 1; > goto end; > } [...] Once again, ffmpeg-user is for questions regarding the FFmpeg cli tools. Your question belongs on libav-user; the mailing list for the FFmpeg libraries. See http://ffmpeg.org/contact.html ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] Filters and chains
Im trying to walk the filtergraphs chain using code to see what is happening for (i = 0; i < nb_filtergraphs; i++) { FilterGraph *fg = filtergraphs[i]; int j; av_log( NULL, AV_LOG_WARNING, "Filter %3d %s [%d, %d]\n", fg->index, fg->graph_desc, fg->nb_inputs, fg->nb_outputs); for (j = 0; j < fg->nb_inputs; j++) { av_log( NULL, AV_LOG_WARNING, " Input %3d %s\n", j, fg->inputs[j]->name); } for(j = 0; j < fg->nb_outputs; j++) { av_log( NULL, AV_LOG_WARNING, " Output %3d %s\n", j, fg->outputs[j]->name); } } Now with this simple filter'scale=640:360,delogo=100:100:100:100,drawbox=10:10:16:9:4:color=yellow' I get Filter 0 scale=640:360,delogo=100:100:100:100,drawbox=10:10:16:9:4:color=yellow [1, 1] Input 0 scale Output 0 drawbox Filter 1 (null) [1, 1] Input 0 (null) Output 0 (null) Where is the delogo, is there another chain i need to walk? joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] Adding an overlay once an hour for 5 minutes
How would i go about adding an .png overlay to a live stream for 5 minutes every hour? Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] Adding an overlay once an hour for 5 minutes
Thanks will give it a try Joolz On Thursday, 3 March 2016, 10:48, Clément Bœsch wrote: On Thu, Mar 03, 2016 at 09:41:27AM +, JULIAN GARDNER wrote: > How would i go about adding an .png overlay to a live stream for 5 minutes > every hour? Joolz overlay has support for timeline, so an overlay with enable option, using an expression with t for the time, between() to bound to 5 minutes, and a mod() to have a redundancy every hour should do. I'd say something like enable='between(mod(t,60*60), 0, 5*60)' (untested). -- Clément B. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] Adding an option to dvbsubs.c
Ive tried to add a "dvbs_y_offset" into the dvb subtitles encoder and finding that i now have a crash in opt.c when i set this value to anything added in the variable in the context typedef struct DVBSubtitleContext { int object_version; int dvbs_y_offfset; } DVBSubtitleContext; code added static av_cold int dvbsub_init_encode(AVCodecContext *avctx) { DVBSubtitleContext *s = avctx->priv_data; av_log( avctx, AV_LOG_INFO, "offset now %d\r\n", s->dvbs_y_offfset); return 0; } static av_cold int dvbsub_close_encode(AVCodecContext *avctx) { av_log( avctx, AV_LOG_INFO, "Closedown\r\n"); return 0; } #define DS AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { {"dvbs_y_offfset", "Sets offset for moving subtitles up/down", offsetof(DVBSubtitleContext, dvbs_y_offfset), AV_OPT_TYPE_INT, {.i64 = 0}, -128, 128, DS}, {NULL} }; static const AVClass dvbsub_class = { .class_name = "DVB Sub Encoder", .item_name = av_default_item_name, .option = options, .version = LIBAVUTIL_VERSION_INT, }; AVCodec ff_dvbsub_encoder = { .name = "dvbsub", .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"), .type = AVMEDIA_TYPE_SUBTITLE, .id = AV_CODEC_ID_DVB_SUBTITLE, .priv_data_size = sizeof(DVBSubtitleContext), .init = dvbsub_init_encode, .close = dvbsub_close_encode, .encode_sub = dvbsub_encode, .priv_class = &dvbsub_class, }; Now I get a crash in opt.c once ffmpeg closes comand lineffmpeg -i x.ts -c:v copy -c:a copy -y_offset -32 -s:dvbsub -y -f mpegts a.ts [dvbsub @ 0xe761b00] Closedown ==26910== Invalid read of size 8 ==26910== at 0xF019C2: av_opt_next (opt.c:51) ==26910== by 0xF019C2: av_opt_free (opt.c:1450) ==26910== by 0x44C549: avcodec_close (utils.c:2691) ==26910== by 0x9CF688: avcodec_free_context (options.c:171) ==26910== by 0x499B31: ffmpeg_cleanup (ffmpeg.c:807) ==26910== by 0x481C40: exit_program (cmdutils.c:120) ==26910== by 0x47F8E3: main (ffmpeg.c:4650) ==26910== Address 0x14 is not stack'd, malloc'd or (recently) free'd ==26910== ==26910== ==26910== Process terminating with default action of signal 11 (SIGSEGV) ==26910== Access not within mapped region at address 0x14 ==26910== at 0xF019C2: av_opt_next (opt.c:51) ==26910== by 0xF019C2: av_opt_free (opt.c:1450) ==26910== by 0x44C549: avcodec_close (utils.c:2691) ==26910== by 0x9CF688: avcodec_free_context (options.c:171) ==26910== by 0x499B31: ffmpeg_cleanup (ffmpeg.c:807) ==26910== by 0x481C40: exit_program (cmdutils.c:120) ==26910== by 0x47F8E3: main (ffmpeg.c:4650) ==26910== If you believe this happened as a result of a stack ==26910== overflow in your program's main thread (unlikely but ==26910== possible), you can try to increase the size of the ==26910== main thread stack using the --main-stacksize= flag. ==26910== The main thread stack size used in this run was 8388608. Joolz Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] Adding an option to dvbsubs.c
thanks missed that Joolz On Saturday, 12 March 2016, 14:53, Carl Eugen Hoyos wrote: JULIAN GARDNER btinternet.com> writes: > Ive tried to add a "dvbs_y_offset" into the dvb subtitles > encoder and finding that i now have a crash in opt.c > when i set this value to anything added in the variable > in the context > > typedef struct DVBSubtitleContext { > int object_version; First element has to be: const AVClass *class; Carl Eugen ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] dvb subtitles
I have dvbsubs working and being overlaid on the screen butI dont want the dvbsubs muxing into the output stream example command line ffmpeg -i bbc_news.ts -c:libx264 -c:a copy -c:s copy -filter_complex '[0:#0x102] sub,[0:v][sub] overlay' -f mpegts dvb_news_hard.ts Now i have at the end 3 streams. Video, Audio and Dvbsubs, is there anyway of removing the Dvbsubs from the output chain Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] dvb subtitles
Did you change the pid to the correct one, sorry made a little mistake ffmpeg -canvas_size 720x576 -i bbc_news.ts -c:v libx264 -c:a copy -c:s copy -filter_complex '[0:#0x69] scale=720:576 [sub],[0:v][sub] overlay' -y -f mpegts bbc_news_hard.ts Joolz On Thursday, 7 April 2016, 13:19, Carl Eugen Hoyos wrote: JULIAN GARDNER btinternet.com> writes: > ffmpeg -i bbc_news.ts -c:libx264 -c:a copy -c:s copy > -filter_complex '[0:#0x102] sub,[0:v][sub]overlay' > -f mpegts dvb_news_hard.ts Could you also provide the complete, uncut console output? The reason I ask is that this command does not work here and I am curious how it works for you. Thank you, Carl Eugen ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] dvb subtitles
ffmpeg -canvas_size 720x576 -i bbc_news.ts -c:v libx264 -c:a copy -c:s copy -filter_complex '[0:#0x69] scale=720:576 [sub],[0:v][sub] overlay' -y -f mpegts bbc_news_hard.ts ffmpeg version N-78956-g920f592 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1) configuration: --bindir=/home/encoder/bin --enable-gpl --enable-version3 --enable-nonfree --disable-ffserver --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-libxcb --enable-libmp3lame --enable-postproc --enable-libfaac --enable-libzvbi --enable-libx264 --enable-libx265 --cc='ccache cc' libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 28.100 / 57. 28.100 libavformat 57. 28.100 / 57. 28.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 39.102 / 6. 39.102 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 [mpeg2video @ 0x3aa7fc0] Invalid frame dimensions 0x0. Last message repeated 22 times Input #0, mpegts, from 'bbc_news.ts': Duration: N/A, start: 56132.888667, bitrate: N/A Program 4168 Stream #0:0[0x65]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 704x576 [SAR 16:11 DAR 16:9], max. 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x66](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s Stream #0:2[0x6a](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, mono, s16p, 64 kb/s (visual impaired) Stream #0:3[0x69](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) [libx264 @ 0x3d9bbc0] using SAR=16/11 [libx264 @ 0x3d9bbc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64 [libx264 @ 0x3d9bbc0] profile High, level 3.0 Output #0, mpegts, to 'bbc_news_hard.ts': Metadata: encoder : Lavf57.28.100 Stream #0:0: Video: h264 (libx264), yuv420p, 704x576 [SAR 16:11 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc (default) Metadata: encoder : Lavc57.28.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream #0:1(eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, 256 kb/s Stream #0:2(eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006), 720x576 Stream mapping: Stream #0:0 (mpeg2video) -> overlay:main Stream #0:3 (dvbsub) -> scale overlay -> Stream #0:0 (libx264) Stream #0:1 -> #0:1 (copy) Stream #0:3 -> #0:2 (copy) Press [q] to stop, [?] for help frame= 196 fps= 63 q=-1.0 Lsize= 1352kB time=00:00:08.96 bitrate=1235.8kbits/s dup=35 drop=0 speed=2.88x video:985kB audio:237kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 10.664502% [libx264 @ 0x3d9bbc0] frame I:2 Avg QP:21.18 size: 52366 [libx264 @ 0x3d9bbc0] frame P:69 Avg QP:23.09 size: 10499 [libx264 @ 0x3d9bbc0] frame B:125 Avg QP:27.28 size: 1435 [libx264 @ 0x3d9bbc0] consecutive B-frames: 7.1% 15.3% 24.5% 53.1% [libx264 @ 0x3d9bbc0] mb I I16..4: 9.9% 86.1% 4.0% [libx264 @ 0x3d9bbc0] mb P I16..4: 1.2% 6.8% 0.7% P16..4: 37.7% 13.4% 10.2% 0.0% 0.0% skip:29.9% [libx264 @ 0x3d9bbc0] mb B I16..4: 0.0% 0.2% 0.0% B16..8: 28.9% 1.7% 0.5% direct: 0.6% skip:68.0% L0:41.0% L1:52.6% BI: 6.5% [libx264 @ 0x3d9bbc0] 8x8 transform intra:79.8% inter:81.1% [libx264 @ 0x3d9bbc0] coded y,uvDC,uvAC intra: 72.5% 82.1% 55.1% inter: 11.6% 14.2% 2.2% [libx264 @ 0x3d9bbc0] i16 v,h,dc,p: 48% 26% 5% 22% [libx264 @ 0x3d9bbc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 19% 22% 5% 6% 6% 5% 6% 6% [libx264 @ 0x3d9bbc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 13% 6% 9% 7% 6% 6% 5% [libx264 @ 0x3d9bbc0] i8c dc,h,v,p: 43% 22% 27% 9% [libx264 @ 0x3d9bbc0] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x3d9bbc0] ref P L0: 63.6% 14.4% 16.1% 5.9% [libx264 @ 0x3d9bbc0] ref B L0: 86.9% 11.6% 1.5% [libx264 @ 0x3d9bbc0] ref B L1: 92.9% 7.1% [libx264 @ 0x3d9bbc0] kb/s:1029.08 Joolz On Thursday, 7 April 2016, 13:37, JULIAN GARDNER wrote: Did you change the pid to the correct one, sorry made a little mistake ffmpeg -canvas_size 720x576 -i bbc_news.ts -c:v libx264 -c:a copy -c:s copy -filter_complex '[0:#0x69] scale=720:576 [sub],[0:v][sub] overlay' -y -f mpegts bbc_news_hard.ts Joolz On Thursday, 7 April 2016, 13:19, Carl Eugen Hoyos wrote: JULIAN GARDNER btinternet.com> writes: > ffmpeg -i bbc_news.ts -c:libx264 -c:a copy -c:s copy > -filter_complex '[0:#0x102] sub,[0:v][sub]overlay' > -f mpegts dvb_news_hard.ts Could you also provide the complete, uncut console output? The reason I ask is that this command does not work here and I am curious how it works for you. Thank you, Carl Eugen ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user ___ ffmpeg-
Re: [FFmpeg-user] dvb subtitles
Sorry i thought i needed it for the decoding o fthe stream to be able to overlay the subtitles. Will give it a whirl Joolz On Thursday, 7 April 2016, 14:32, Carl Eugen Hoyos wrote: JULIAN GARDNER btinternet.com> writes: > ffmpeg -canvas_size 720x576 -i bbc_news.ts -c:v libx264 -c:a copy > -c:s copy > -filter_complex '[0:#0x69]scale=720:576 [sub],[0:v][sub] overlay' > -y -f mpegts bbc_news_hard.ts I am not sure I understand: Did you ask how not to copy the subtitle stream? I ask because you specify "-c:s copy" which requests to copy the subtitle stream. If you don't want to copy the subtitle stream please try to remove the option that requests copying it. Please avoid top-posting here. Carl Eugen ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] Still cant get this code to work, was taken from one of the demos.
I am in the middle of trying to add a VU Meter to my application but when I try and convert the audio buffer from FLTP to S16 I get a crash and I cannot see what im doing wrong. Now this code also fails in the demo applications. outputSettings->audio_channels = 2;outputSettings->audio_format = AV_SAMPLE_FMT_S16;outputSettings->audio_sample_rate = 32000; This is the source file and its outputffprobe version N-78956-g920f592 Copyright (c) 2007-2016 the FFmpeg developers Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mv/ABC - The Look Of Love (1982).mp4': Metadata: major_brand : isom minor_version : 1 compatible_brands: isomavc1 creation_time : 2011-08-31 10:04:04 Duration: 00:03:33.21, start: 0.00, bitrate: 1114 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 919 kb/s, 29.97 fps, 29.97 tbr, 120k tbn, 59.94 tbc (default) Metadata: creation_time : 2011-08-31 10:04:04 Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 192 kb/s (default) Metadata: creation_time : 2011-08-31 10:04:08 Side data: audio service type: main So I want the audio to be converted to S16 so I can use this as the output to the new stream and also processed as a VuMeter if( !inputSource->audio_scale_ctx) { /* create resampler context */ inputSource->audio_scale_ctx = swr_alloc_set_opts(NULL, av_get_default_channel_layout(outputSettings->audio_channels), outputSettings->audio_format, outputSettings->audio_sample_rate, av_get_default_channel_layout(inputSource->fmt_ctx->streams[inputSource->audio_stream_idx]->codec->channels), inputSource->fmt_ctx->streams[inputSource->audio_stream_idx]->codec->sample_fmt, inputSource->fmt_ctx->streams[inputSource->audio_stream_idx]->codec->sample_rate, 0, NULL); /* initialize the resampling context */ if ( swr_init(inputSource->audio_scale_ctx)<0) { fprintf(stderr, "Failed to initialize the resampling context\n"); exit(1); } printf( "Tile audio resampling from %d:%d:%s to %d:%d:%s\n", inputSource->fmt_ctx->streams[inputSource->audio_stream_idx]->codec->channels, inputSource->fmt_ctx->streams[inputSource->audio_stream_idx]->codec->sample_rate, audioFormats[inputSource->fmt_ctx->streams[inputSource->audio_stream_idx]->codec->sample_fmt].name, outputSettings->audio_channels, outputSettings->audio_sample_rate, audioFormats[outputSettings->audio_format].name); } dst_nb_samples = av_rescale_rnd(swr_get_delay(inputSource->audio_scale_ctx, inputSource->audio_dec_ctx->sample_rate) + frame->nb_samples, outputSettings->audio_sample_rate, inputSource->audio_dec_ctx->sample_rate, AV_ROUND_UP); if( dst_nb_samples>inputSource->audio_frame_size) { if( inputSource->audio_frame) av_frame_free(&inputSource->audio_frame); inputSource->audio_frame = alloc_audio_frame(outputSettings->audio_format, outputSettings->audio_channels, outputSettings->audio_sample_rate, dst_nb_samples); // inputSource->audio_frame_size = dst_nb_samples; printf( "Tile audio resampling frame size changed from %d to %d\r\n", inputSource->audio_frame_size, dst_nb_samples); } else if( !inputSource->audio_frame_size) { inputSource->audio_frame = alloc_audio_frame(outputSettings->audio_format, outputSettings->audio_channels, outputSettings->audio_sample_rate, dst_nb_samples); // inputSource->audio_frame_size = dst_nb_samples; printf( "Tile audio resampling frame size changed from %d to %d\r\n", inputSource->audio_frame_size, dst_nb_samples); } if( av_frame_make_writable(inputSource->audio_frame)<0) { exit(1); } /* convert to destination format */ printf( "%p %p %d %p %d\n", inputSource->audio_scale_ctx, inputSource->audio_frame->data, inputSource->audio_frame->nb_samples, (const uint8_t **)frame->data, frame->nb_samples); /* convert to destination format */ ret = swr_convert(inputSource->audio_scale_ctx, inputSource->audio_frame->data, inputSource->audio_frame->nb_samples, (const uint8_t **)frame->data, frame->nb_samples); if (ret < 0) { fprintf(stde
[FFmpeg-user] Some guidence on finding this problem.
I have 2 machines running ffmpeg, one is doing normal transcoding the 2nd is using a bought in h265 hardware encoder. Software HEVC encoding is based onffmpeg N-78956-g920f592x265 1.9_54-291beccb6760 Hardware HEVC encoding is based onffmpeg 3.0.2 Now I am sure that x265 and the hardware encoding are not to blame and believe that the software decoding is at fault as BOTH versions fail at the same time and show the exact same video output once they have failed. My problem is that this happens once every 2-5 days so my question is how do i capture what will be needed to give you guys a good stream to try and fix this problem. Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Some guidence on finding this problem.
Im reporting this as a decoding issue due to the fact that 2 different machines using 2 different encoding backends fail the EXACT same way, and when they fail the encoded picture looks EXACTLY the same on both outputs. I will start a TS Recording and then try and chop this up to get a small TS with the failure but as the stream is HD at source will be a big recording. The command lines for the 2 encodings are different as one use x265 and the other a bought in hardware encoder. Joolz On Tuesday, 2 August 2016, 14:05, Carl Eugen Hoyos wrote: Hi! 2016-08-02 11:05 GMT+02:00 JULIAN GARDNER : > I have 2 machines running ffmpeg, one is doing normal transcoding the 2nd is > using a bought in h265 hardware encoder. > Software HEVC encoding is based onffmpeg N-78956-g920f592x265 > 1.9_54-291beccb6760 > Hardware HEVC encoding is based onffmpeg 3.0.2 If the issue you see is not reproducible with current FFmpeg, there is nothing that we can fix. > Now I am sure that x265 and the hardware encoding are not to blame and > believe that the software decoding is at fault as BOTH versions fail at the > same time and show the exact same video output once they have failed. Sorry, I am not a native speaker and I find this difficult to understand: Are you reporting a decoding issue? How is it related to the encoding properties you describe above? > My problem is that this happens once every 2-5 days so my question is how do > i capture what will be needed to give you guys a good stream to try and fix > this problem. How does the command look that you are currently using to decoder? If you provide it, it should be easy to know how to capture. Carl Eugen ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Some guidence on finding this problem.
@ 0x2f13640] Reference 4 >= 2 [h264 @ 0x2f13640] error while decoding MB 2 1, bytestream 17445 [h264 @ 0x2d225a0] top block unavailable for requested intra4x4 mode -1 at 1 1 [h264 @ 0x2d225a0] error while decoding MB 1 1, bytestream 7127 [h264 @ 0x2d69500] top block unavailable for requested intra4x4 mode -1 at 10 0 [h264 @ 0x2d69500] error while decoding MB 10 0, bytestream 4482 [h264 @ 0x2df73c0] Reference 2 >= 2 [h264 @ 0x2df73c0] error while decoding MB 25 16, bytestream 4664 [h264 @ 0x2e3e460] Reference 2 >= 2 [h264 @ 0x2e3e460] error while decoding MB 85 13, bytestream 4554 [h264 @ 0x2e85500] Reference 8 >= 4 [h264 @ 0x2e85500] error while decoding MB 26 0, bytestream 11033 [h264 @ 0x2ecc5a0] Reference 5 >= 2 [h264 @ 0x2ecc5a0] error while decoding MB 7 1, bytestream 9995 [h264 @ 0x2f13640] Reference 2 >= 2 [h264 @ 0x2f13640] error while decoding MB 11 0, bytestream 6345 [h264 @ 0x2c6b040] Reference 2 >= 2 [h264 @ 0x2c6b040] error while decoding MB 22 1, bytestream 5825 [h264 @ 0x2d69500] Reference 2 >= 2 344kB time=00:00:09.13 bitrate= 308.7kbits/s dup=7 drop=1 speed=0.719x [h264 @ 0x2d69500] error while decoding MB 81 11, bytestream 2716 [h264 @ 0x2db0460] Reference 3 >= 2 [h264 @ 0x2db0460] error while decoding MB 118 12, bytestream 2138 [h264 @ 0x2e3e460] top block unavailable for requested intra mode at 45 0 [h264 @ 0x2e3e460] error while decoding MB 45 0, bytestream 10651 [h264 @ 0x2ecc5a0] Reference 2 >= 2 [h264 @ 0x2ecc5a0] error while decoding MB 11 0, bytestream 5889 [h264 @ 0x2f13640] Reference 2 >= 2 [h264 @ 0x2f13640] error while decoding MB 6 1, bytestream 5593 [h264 @ 0x2d225a0] Reference 2 >= 2 [h264 @ 0x2d225a0] error while decoding MB 94 13, bytestream 2835 Joolz On Tuesday, 2 August 2016, 14:11, JULIAN GARDNER wrote: Im reporting this as a decoding issue due to the fact that 2 different machines using 2 different encoding backends fail the EXACT same way, and when they fail the encoded picture looks EXACTLY the same on both outputs. I will start a TS Recording and then try and chop this up to get a small TS with the failure but as the stream is HD at source will be a big recording. The command lines for the 2 encodings are different as one use x265 and the other a bought in hardware encoder. Joolz On Tuesday, 2 August 2016, 14:05, Carl Eugen Hoyos wrote: Hi! 2016-08-02 11:05 GMT+02:00 JULIAN GARDNER : > I have 2 machines running ffmpeg, one is doing normal transcoding the 2nd is > using a bought in h265 hardware encoder. > Software HEVC encoding is based onffmpeg N-78956-g920f592x265 > 1.9_54-291beccb6760 > Hardware HEVC encoding is based onffmpeg 3.0.2 If the issue you see is not reproducible with current FFmpeg, there is nothing that we can fix. > Now I am sure that x265 and the hardware encoding are not to blame and > believe that the software decoding is at fault as BOTH versions fail at the > same time and show the exact same video output once they have failed. Sorry, I am not a native speaker and I find this difficult to understand: Are you reporting a decoding issue? How is it related to the encoding properties you describe above? > My problem is that this happens once every 2-5 days so my question is how do > i capture what will be needed to give you guys a good stream to try and fix > this problem. How does the command look that you are currently using to decoder? If you provide it, it should be easy to know how to capture. Carl Eugen ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Some guidence on finding this problem.
> > >Hi! > >2016-08-03 11:47 GMT+02:00 JULIAN GARDNER : >> Well I have managed to copy a .ts which has the problem, had to record over >> 8 hours of tv just for this. >> Run the command line and around 8.02 seconds it fails. > >I beleive you forgot to post a link, >Please avoid top-posting here, thank you, Carl Eugen > >___ >ffmpeg-user mailing list >ffmpeg-user@ffmpeg.org >http://ffmpeg.org/mailman/listinfo/ffmpeg-user > >To unsubscribe, visit link above, or email >ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > > https://mega.nz/#!N85HUBLL!VZxel7HPtlcf0psH3WfYLOGnrL3d87iZSq5xdpXl7L4 ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Some guidence on finding this problem.
Joolz On Wednesday, 3 August 2016, 12:08, Carl Eugen Hoyos wrote: > > >2016-08-03 11:47 GMT+02:00 JULIAN GARDNER : > >> encoder@encoder:~$ ffmpeg -i failure_chomped.ts -c:v libx265 -c:a libfaac -y >> -f mpegts a.ts > >Unrelated: There are two better aac encoders than libfaac, and please >remember that using >external libraries to report issues that are reproducible with >internal decoders and encoders >- for example ffmpeg -i input -qscale 2 out.avi - just makes FAILS AS WELL Peay tell us underlings which encoders you believe are better, or is it a secret >understanding the issue much harder. > >> ffmpeg version N-78956-g920f592 Copyright (c) 2000-2016 the FFmpeg developers > >Please remember to always test current FFmpeg git head before >reporting issues, we >generally cannot fix issues in old versions (and this case is >apparently particularly hard). >Your sample would have been very important five months ago... Im sorry but my time machine is broken at the moment. >>Thank you, Carl Eugen>>___ >ffmpeg-user mailing list >ffmpeg-user@ffmpeg.org >http://ffmpeg.org/mailman/listinfo/ffmpeg-user > >To unsubscribe, visit link above, or email >ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". >> joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Some guidence on finding this problem.
Joolz > On Wednesday, 3 August 2016, 12:42, JULIAN GARDNER > wrote: > > > > > > Joolz > > > On Wednesday, 3 August 2016, 12:08, Carl Eugen Hoyos > wrote: > > >> >> >> 2016-08-03 11:47 GMT+02:00 JULIAN GARDNER : >> >>> encoder@encoder:~$ ffmpeg -i failure_chomped.ts -c:v libx265 -c:a > libfaac -y -f mpegts a.ts >> >> Unrelated: There are two better aac encoders than libfaac, and please >> remember that using >> external libraries to report issues that are reproducible with >> internal decoders and encoders >> - for example ffmpeg -i input -qscale 2 out.avi - just makes > > FAILS AS WELL > > Peay tell us underlings which encoders you believe are better, or is it a > secret > >> understanding the issue much harder. >> >>> ffmpeg version N-78956-g920f592 Copyright (c) 2000-2016 the FFmpeg > developers >> >> Please remember to always test current FFmpeg git head before >> reporting issues, we >> generally cannot fix issues in old versions (and this case is >> apparently particularly hard). > >> Your sample would have been very important five months ago... > > Im sorry but my time machine is broken at the moment. > >>> Thank you, Carl > Eugen>>___ >> ffmpeg-user mailing list >> ffmpeg-user@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-user >> >> To unsubscribe, visit link above, or email >> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > >>> > joolz > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > Ok build a new version for git and it works, so I will now go through and try and pull this in to my repository. There is an error and this seems to have been solved in the new c file h2645_parse.c. joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Some guidence on finding this problem.
On Wednesday, 3 August 2016, 14:08, Carl Eugen Hoyos wrote: > > >2016-08-03 12:49 GMT+02:00 JULIAN GARDNER : >> Ok build a new version for git and it works, so I will now go through and >> try and pull this in to my repository. > >Do I understand correctly that you are trying to backport the fix? >If you succeed, please explain, I failed and nobody else wants to >work on it;-( > > >Carl Eugen >___ >ffmpeg-user mailing list >ffmpeg-user@ffmpeg.org >http://ffmpeg.org/mailman/listinfo/ffmpeg-user > >To unsubscribe, visit link above, or email >ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > > I will try and if I cannot I will have to port my changes in the latest snapshot, not something i like doing joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Some guidence on finding this problem.
Joolz > On Wednesday, 3 August 2016, 14:33, Carl Eugen Hoyos > wrote: > > 2016-08-03 14:22 GMT+02:00 JULIAN GARDNER : >> I will try and if I cannot I will have to port my changes in the latest > snapshot, not something i like doing > > Did you ever try to get your changes into FFmpeg to make your life easier? > (It is not only us who tested your file to find an old bug but also > you who wrote several emails and had to record a sample that allows > reproducing.) > > > Carl Eugen > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > I have given up trying, always not relevant or "the spec does not say that" Im still trying to get my mpegts-si-table-version ported to the mpegts.c, but with all the changes it is taking ages. joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Some guidence on finding this problem.
Joolz > On Wednesday, 3 August 2016, 16:18, Carl Eugen Hoyos > wrote: > > 2016-08-03 14:55 GMT+02:00 JULIAN GARDNER : >> On Wednesday, 3 August 2016, 14:33, Carl Eugen Hoyos > wrote: >>> >>> Did you ever try to get your changes into FFmpeg to make your life > easier? >>> (It is not only us who tested your file to find an old bug but also >>> you who wrote several emails and had to record a sample that allows >>> reproducing.) >> >> I have given up trying, always not relevant or "the spec does not say > that" > > Are your changes on github or similar? > > > Carl Eugen > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > local ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] ffprobe question
I have a MPTS stream and would like to ffprobe a certain program, not all the programs. Is there a way like i do with ffmpeg using "-map 0:p:4" Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] problem with trying maths in a filter
tried a few versions on varying machines but cant get this work, so can someone help me as to why these filters dont work this overlay=x=32+(mod(t/30,1)*448):y=32+(mod(t/60,1)*206) or this overlay=x=32+mul(mod(t/30,1),448):y=32+mul(mod(t/60,1),206) I get this error [AVFilterGraph @ 0x2c3a880] No such filter: '1)*448):y' -- BR Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] problem with trying maths in a filter
Thanks for that, works now. Maybe i should look at the eval code and fix it --- BR Joolz On 2019-08-22 00:24, James Darnley wrote: On 2019-08-21 23:44, Julian Gardner wrote: tried a few versions on varying machines but cant get this work, so can someone help me as to why these filters dont work this overlay=x=32+(mod(t/30,1)*448):y=32+(mod(t/60,1)*206) or this overlay=x=32+mul(mod(t/30,1),448):y=32+mul(mod(t/60,1),206) I get this error [AVFilterGraph @ 0x2c3a880] No such filter: '1)*448):y' Unfortunately you need to escape the commas , with a backslash \ to make \, because commas are used to separate filters. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] problem with trying maths in a filter
--- BR Joolz On 2019-08-22 17:50, Carl Zwanzig wrote: On 8/22/2019 12:05 AM, Julian Gardner wrote: Maybe i should look at the eval code and fix it But is it really broken? Using the same separator for different purposes might be bad design, but almost any change is probably worse. (please don't top-post) Later, z! ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". Yes its broken, a comma in between an open bracket and a close bracket should be treated different. BR joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] problem with trying maths in a filter
--- BR Joolz On 2019-08-22 17:50, Carl Zwanzig wrote: On 8/22/2019 12:05 AM, Julian Gardner wrote: Maybe i should look at the eval code and fix it But is it really broken? Using the same separator for different purposes might be bad design, but almost any change is probably worse. (please don't top-post) Later, z! ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". Works but not as intended. How do i get the mod(t/30,2) give me and integer of either 0 or 1 BR Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] problem with trying maths in a filter
On 2019-08-23 09:03, Moritz Barsnick wrote: On Thu, Aug 22, 2019 at 19:36:09 +0200, Julian Gardner wrote: How do i get the mod(t/30,2) give me and integer of either 0 or 1 floor(mod(t/30,2)), presumably. Cheers, Moritz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". Thanks again. --- BR Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] changes to ffmpeg to stop having to put an escape
A few weeks ago I had a problem with some eval code and it was pointed out that i need to escape the ','. So here is a small patch that needs passing on to the devel guys to have a look at. All this does is to ignore the fixed tokens when inside parenthesis, so this works now -filter_complex '[0:v] scale=160:90 [out], [v:0][out] overlay=x=mod(10,2):y=20' patch is here diff --git a/libavutil/avstring.c b/libavutil/avstring.c index 4c068f5..e19db8f 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -150,14 +150,26 @@ char *av_get_token(const char **buf, const char *term) { char *out = av_malloc(strlen(*buf) + 1); char *ret = out, *end = out; +int p_count = 0; + const char *p = *buf; if (!out) return NULL; p += strspn(p, WHITESPACES); -while (*p && !strspn(p, term)) { +while (*p && (!strspn(p, term) || p_count)) { char c = *p++; -if (c == '\\' && *p) { +if (c == ')') { +if( p_count) { +p_count--; +} +*out++ = c; +} +else if (c == '(') { +p_count++; +*out++ = c; +} +else if (c == '\\' && *p) { *out++ = *p++; end= out; } else if (c == '\'') { -- BR Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] changes to ffmpeg to stop having to put an escape
On 2019-09-17 11:42, Nicolas George wrote: Julian Gardner (12019-09-16): A few weeks ago I had a problem with some eval code and it was pointed out that i need to escape the ','. So here is a small patch that needs passing on to the devel guys to have a look at. All this does is to ignore the fixed tokens when inside parenthesis, so this works now This one works, and every other case involving parentheses becomes more complex. Therefore it is not a good idea. It is possible to get rid of the escaping, but it requires the parser to be aware of context. Small fixes like that only make thing harder in the long run. Regards, Can you show me a case where this will cause a failure as all my filters work as they should. Bear in mind this only fixes the cases where escaping is required inside parenthesis. --- BR Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] changes to ffmpeg to stop having to put an escape
On 2019-09-17 12:52, Nicolas George wrote: Julian Gardner (12019-09-17): Can you show me a case where this will cause a failure as all my filters work as they should. Bear in mind this only fixes the cases where escaping is required inside parenthesis. It will fail everywhere parentheses are not supposed to be balanced. Regards, ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". Not balanced, can you please give me an example so I can look into the problem. I can think of only one case and that would be someone using braces inside a text field? BR Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] changes to ffmpeg to stop having to put an escape
On 2019-09-17 17:25, Nicolas George wrote: Julian Gardner (12019-09-17): Not balanced, can you please give me an example so I can look into the problem. I can think of only one case and that would be someone using braces inside a text field? Exactly. The function you are proposing to change is meant to parse strings. Giving it a special case for parentheses is a maintenance and user-experience nightmare. Regards, ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". No its meant to parse anything, not just strings BR Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] changes to ffmpeg to stop having to put an escape
You mean like this diff --git a/libavutil/avstring.c b/libavutil/avstring.c index 4c068f5..8a264c0 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -150,14 +150,26 @@ char *av_get_token(const char **buf, const char *term) { char *out = av_malloc(strlen(*buf) + 1); char *ret = out, *end = out; +int p_count = 0; +int speech = 0; + const char *p = *buf; if (!out) return NULL; p += strspn(p, WHITESPACES); -while (*p && !strspn(p, term)) { +while (*p && (!strspn(p, term) || p_count)) { char c = *p++; -if (c == '\\' && *p) { +if (c == 0x22) { +speech = !speech; +*out++ = c; +} else if (speech) { +*out++ = c; +} else if (c == ')') { +if( p_count) { +p_count--; +} +*out++ = c; +} +else if (c == '(') { +p_count++; +*out++ = c; +} +else if (c == '\\' && *p) { *out++ = *p++; end= out; } else if (c == '\'') { --- BR Joolz On 2019-09-17 17:25, Nicolas George wrote: Julian Gardner (12019-09-17): Not balanced, can you please give me an example so I can look into the problem. I can think of only one case and that would be someone using braces inside a text field? Exactly. The function you are proposing to change is meant to parse strings. Giving it a special case for parentheses is a maintenance and user-experience nightmare. Regards, ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] changes to ffmpeg to stop having to put an escape
On 2019-09-17 17:35, Nicolas George wrote: Julian Gardner (12019-09-17): No its meant to parse anything, not just strings I assure you, it is meant to parse strings. The name of the file should be a hint. It has been abused to parse anything, but it is meant for strings. Fixing the problem with escaping needs to rework the problem from the top, not from the bottom. Regards, ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". and the name of the function should give you an idea av_get_token! --- BR Joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] .pls does ffmpeg support this
Im trying to get radio working but if i use this "http://bbc.co.uk/radio/listen/live/r4_aaclca.pls"; as the input to ffmpeg i get "invalid data found" I checked with '-loglevel debug' and it seems to pull in the correct number of bytes for the .pls file, but nothing after. joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] .pls does ffmpeg support this
- Original Message - > From: Carl Eugen Hoyos > To: ffmpeg-user@ffmpeg.org > Cc: > Sent: Friday, 18 July 2014, 13:51 > Subject: Re: [FFmpeg-user] .pls does ffmpeg support this > > JULIAN GARDNER btinternet.com> writes: > >> Im trying to get radio working but if i use this >> "http://bbc.co.uk/radio/listen/live/r4_aaclca.pls"; >> as the input to ffmpeg i get "invalid data found" > > FFmpeg does not support playlists (you can find old patches), > I cannot test atm but the streams inside the text files > should / may work fine. > > Carl Eugen > > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-user > OK thanks, the streams inside do work ok joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] Removing an audio stream
I am encoding a stream using the option "-map 0:p:2" but this pulls in all the audio streams which I dont want. How do i remove a certain stream before encoding Commandline ffmpeg -i udp://224.10.1.0:1234?reuse&fifo_size=5 -c:v libx264 -c:a libfaac -map 0:p:2 -async 1 -f mpegts 'udp://225.176.4.60:50501?pkt_size=1316&buffer_size=1048576 So this is the debug I get 2014-09-15_12:00:09.03449 ffmpeg version N-63057-g63504d8 Copyright (c) 2000-2014 the FFmpeg developers 2014-09-15_12:00:09.03451 built on Jul 23 2014 13:59:12 with gcc 4.6 (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) 2014-09-15_12:00:09.03451 configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libzvbi --cc='ccache cc' 2014-09-15_12:00:09.03452 libavutil 52. 82.100 / 52. 82.100 2014-09-15_12:00:09.03452 libavcodec 55. 60.103 / 55. 60.103 2014-09-15_12:00:09.03453 libavformat 55. 37.102 / 55. 37.102 2014-09-15_12:00:09.03453 libavdevice 55. 13.101 / 55. 13.101 2014-09-15_12:00:09.03453 libavfilter 4. 5.100 / 4. 5.100 2014-09-15_12:00:09.03454 libswscale 2. 6.100 / 2. 6.100 2014-09-15_12:00:09.03454 libswresample 0. 18.100 / 0. 18.100 2014-09-15_12:00:09.03454 libpostproc 52. 3.100 / 52. 3.100 2014-09-15_12:00:09.25195 [mpeg2video @ 0x1ce7e60] Invalid frame dimensions 0x0. 2014-09-15_12:00:09.67791 Input #0, mpegts, from 'udp://224.10.1.0:1234?reuse&fifo_size=5': 2014-09-15_12:00:09.67793 Duration: N/A, start: 93588.211644, bitrate: 288 kb/s 2014-09-15_12:00:09.67794 Program 2 2014-09-15_12:00:09.67794 Stream #0:0[0x41]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, smpte170m), 704x480 [SAR 10:11 DAR 4:3], max. 14975 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc 2014-09-15_12:00:09.67796 Stream #0:1[0x44](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s 2014-09-15_12:00:09.67797 Stream #0:2[0x45](spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, mono, fltp, 96 kb/s 2014-09-15_12:00:09.67920 -async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.10:first_pts=0. 2014-09-15_12:00:09.69019 Last message repeated 1 times 2014-09-15_12:00:09.69021 [libx264 @ 0x1d297e0] VBV maxrate unspecified, assuming CBR 2014-09-15_12:00:09.69022 [libx264 @ 0x1d297e0] using SAR=5/11 2014-09-15_12:00:09.69089 [libx264 @ 0x1d297e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX 2014-09-15_12:00:09.69611 [libx264 @ 0x1d297e0] profile High, level 2.1 2014-09-15_12:00:09.71000 Output #0, mpegts, to 'udp://225.176.4.60:50501?pkt_size=1316&buffer_size=1048576': 2014-09-15_12:00:09.71002 Metadata: 2014-09-15_12:00:09.71002 service_provider: v-play 2014-09-15_12:00:09.71003 service_name : 1084 2014-09-15_12:00:09.71003 encoder : Lavf55.37.102 2014-09-15_12:00:09.71003 Stream #0:0: Video: h264 (libx264), yuv420p, 704x480 [SAR 5:11 DAR 4:3], q=-1--1, 875 kb/s, 90k tbn, 25 tbc 2014-09-15_12:00:09.71004 Stream #0:1(eng): Audio: aac (libfaac), 32000 Hz, stereo, s16, 96 kb/s 2014-09-15_12:00:09.71004 Stream #0:2(spa): Audio: aac (libfaac), 32000 Hz, stereo, s16, 96 kb/s 2014-09-15_12:00:09.71004 Stream mapping: 2014-09-15_12:00:09.71004 Stream #0:0 -> #0:0 (mpeg2video -> libx264) 2014-09-15_12:00:09.71005 Stream #0:1 -> #0:1 (ac3 -> libfaac) 2014-09-15_12:00:09.71006 Stream #0:2 -> #0:2 (ac3 -> libfaac) 2014-09-15_12:00:09.71006 Press [q] to stop, [?] for help What i would like is to be able to use the -map 0:p:2 and also remove the "Stream #0:2(spa):", I need the "-map 0:p:2" as this is coming from a MPTS joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] Can work out why this does what it does
I am trying to do a little overlay test but cant work out why one works and one fails, the input file i use is one of my SD stream captures from BBC News, so a generic SD video will suffice The 2 command lines Working ffmpeg -i -vcodec libx264 -preset ultrafast -b 3000k -acodec libfaac -async 1 -r 25 -filter_complex 'color=s=640x360:c=#80808080 [o1];[0:v] scale=640x360,drawbox=100:100:100:100:color=green [o0];[o0][o1] overlay' -y -f mpegts a.ts This give the desired result or an opaque screen overlayed over video Non working one ffmpeg -i -vcodec libx264 -preset ultrafast -b 3000k -acodec libfaac -async 1 -r 25 -filter_complex 'color=s=640x360:c=#80808080,drawbox=100:100:100:100:color=red [o1];[0:v] scale=640x360,drawbox=100:100:100:100:color=green [o0];[o0][o1] overlay' -y -f mpegts a.ts On this i get the color screen with no transparency and the red box Any ideas why adding a drawbox will make the color layer lose its transparency joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] Can work out why this does what it does
> From: JULIAN GARDNER >To: ffmpeg-user@ffmpeg.org >Sent: Monday, 22 September 2014, 17:19 >Subject: [FFmpeg-user] Can work out why this does what it does > > >I am trying to do a little overlay test but cant work out why one works and >one fails, the input file i use is one of my SD stream captures from BBC News, >so a generic SD video will suffice > >The 2 command lines > >Working > > >ffmpeg -i -vcodec libx264 -preset ultrafast -b 3000k >-acodec libfaac -async 1 -r 25 -filter_complex 'color=s=640x360:c=#80808080 >[o1];[0:v] scale=640x360,drawbox=100:100:100:100:color=green [o0];[o0][o1] >overlay' -y -f mpegts a.ts > > >This give the desired result or an opaque screen overlayed over video > > >Non working one > >ffmpeg -i -vcodec libx264 -preset ultrafast -b 3000k >-acodec >libfaac -async 1 -r 25 -filter_complex >'color=s=640x360:c=#80808080,drawbox=100:100:100:100:color=red >[o1];[0:v] scale=640x360,drawbox=100:100:100:100:color=green >[o0];[o0][o1] overlay' -y -f mpegts a.ts > > >On this i get the color screen with no transparency and the red box > >Any ideas why adding a drawbox will make the color layer lose its transparency > >joolz OK worked it out, drawbox does not work on any formats with ALPHA being present and coverts these down to non-alpha formats. Looks like im going to have to add in code for working with alpha planes joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] Example C code for encoding/muxing/streaming
Ive been playing with the code and have a little test project I want to try, a mosaic generator. Now Ive been looking through the examples code and tried a few but none seem to be able to stream out over multicast. Has anybody got code/knows of example code which shows how to setup a stream which will output a mpegts to a udp multicast address. I think i have most of the other code from the examples. The mosaic will work this way X streams in, running in threads which will send each I frame to the encoding thread, this thread will resize the incoming frame to the correct size and then put it in the correct place on the output frame. The output frame will then be encoded and streamed out, this is the part that i cannot find any code for. Ive tried ffmpeg for this but when dealing with 9 streams (3x3) the startup time is way to long and it does not auto restart a broken stream, which Im trying to overcome. Any help/involvment would be gratefully received joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] Example C code for encoding/muxing/streaming
> > From: JULIAN GARDNER >To: FFmpeg user questions >Sent: Wednesday, 29 October 2014, 14:34 >Subject: [FFmpeg-user] Example C code for encoding/muxing/streaming > > >Ive been playing with the code and have a little test project I want to try, a mosaic generator. > >Now Ive been looking through the examples code and tried a few but none seem >to be able to stream out over multicast. > >Has anybody got code/knows of example code which shows how to setup a stream >which will output a mpegts to a udp multicast address. > >I think i have most of the other code from the examples. > >The mosaic will work this way > >X streams in, running in threads which will send each I frame to the encoding >thread, this thread will resize the incoming frame to the correct size and then put it in the correct place on the output frame. > >The output frame will then be encoded and streamed out, this is the part that >i cannot find any code for. > >Ive tried ffmpeg for this but when dealing with 9 streams (3x3) the startup >time is way to long and it does not auto restart a broken stream, which Im >trying to overcome. > >Any help/involvment would be gratefully received > >joolz OK its working!, but i need some help on a little problem with my code. snippet below /* initialize packet, set data to NULL, let the demuxer fill it */ av_init_packet(&myframe->pkt); inputSource->pkt.data = NULL; inputSource->pkt.size = 0; /* read frames from the file */ while (!inputSource->quit && !stop_all_tasks && av_read_frame(inputSource->fmt_ctx, &inputSource->pkt) >= 0) { AVPacket orig_pkt = inputSource->pkt; do { ret = decode_packet(&got_frame, 0, inputSource); if (ret < 0) break; inputSource->pkt.data += ret; inputSource->pkt.size -= ret; } while (inputSource->pkt.size > 0); av_free_packet(&orig_pkt); } I then added a callback but this never seems to be called!!! static int interrupt_cb(void *ctx) { inputMosaic *inputSource = ctx; printf( "."); fflush( stdout); if (inputSource->quit || stop_all_tasks) return 1; return 0; } and in the inputThread inputSource->fmt_ctx->interrupt_callback.callback = interrupt_cb; inputSource->fmt_ctx->interrupt_callback.opaque = myframe; Now as this is running in a thread it works well as long as THERE IS data. if no data then this loop just stays here and I cannot kill it when I need to switch the input stream or even close down. Anyone help on this. joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] Rescaling audio samples
Im hoping someone can help me here as I am stuck when trying to resample audio from rate to another rate, this is my own code and not withing ffmpeg's code, using ffmpeg libs LONG MESSAGE WITH CODE output Stream Information: Output #0, mpegts, to 'a0.ts': Stream #0:0: Video: h264 (libx264), yuv420p, 720x576, q=-1--1, 1300 kb/s, 25 tbn, 25 tbc Stream #0:1: Audio: aac (libfaac), 48000 Hz, stereo, s16, 64 kb/s Input Stream Information Input #0, mpegts, from 'udp://225.176.5.178:50206?reuse&fifo_size=5': Duration: N/A, start: 62947.782956, bitrate: N/A Program 1 Metadata: service_name : 1458 Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 720x288 [SAR 32:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 32000 Hz, stereo, fltp, 73 kb/s My Conversion Code static int write_audio_frame(AVFormatContext *out_context, OutputStream *out_stream) { inputStream *inputSource = inputs[0]; AVCodecContext *c; AVPacket pkt = { 0 }; // data and size must be 0; AVFrame *frame = NULL; avPackets *here; int ret; int l; int got_packet = 0; av_init_packet(&pkt); c = out_stream->st->codec; // Get next available packet here = inputSource->packets_list[AUDIO_INDEX]; if( here) { int dst_nb_samples; frame = here->frame; frame->pts = out_stream->next_pts; out_stream->next_pts += frame->nb_samples; /* convert samples from native format to destination codec format, using the resampler */ /* compute destination number of samples */ dst_nb_samples = av_rescale_rnd(swr_get_delay(inputSource->audio_swr_ctx, inputSource->audio_dec_ctx->sample_rate) + frame->nb_samples, c->sample_rate, inputSource->audio_dec_ctx->sample_rate, AV_ROUND_UP); // If i have this assert in it triggers all the time, but as my input is 32000 and my output is 48000 i would expect them to be different //av_assert0(dst_nb_samples == frame->nb_samples); // This gives "rescale_rnd 1024 to 1560" printf( "rescale_rnd %d to %d\r\n", frame->nb_samples, dst_nb_samples); // Reallocate the buffer if the size is biggert if( dst_nb_samples>out_stream->audio_frame_size) { av_frame_free(&ost->audio_frame); out_stream->audio_frame = alloc_audio_frame(c->sample_fmt, c->channel_layout, c->sample_rate, dst_nb_samples); out_stream->audio_frame_size = dst_nb_samples; } /* when we pass a frame to the encoder, it may keep a reference to it * internally; * make sure we do not overwrite it here */ ret = av_frame_make_writable(out_stream->audio_frame); if (ret < 0) exit(1); /* convert to destination format */ ret = swr_convert(inputSource->audio_swr_ctx, out_stream->audio_frame->data, dst_nb_samples, (const uint8_t **)frame->data, frame->nb_samples); if (ret < 0) { fprintf(stderr, "Error while converting\n"); exit(1); } out_stream->audio_frame->pts = av_rescale_q(out_stream->samples_count, (AVRational){1, c->sample_rate}, c->time_base); out_stream->samples_count += dst_nb_samples; // HERE IS THE FAILING CALL ret = avcodec_encode_audio2(c, &pkt, out_stream->audio_frame, &got_packet); if (ret < 0) { fprintf(stderr, "Error encoding audio frame: %s\n", av_err2str(ret)); exit(1); } if (got_packet) { ret = write_frame(out_context, &c->time_base, out_stream->st, &pkt); if (ret < 0) { fprintf(stderr, "Error while writing audio frame: %s\n", av_err2str(ret)); exit(1); } } inputSource->packets_list[AUDIO_INDEX] = here->next; av_frame_free(&here->frame); free( here); } } return 0; //(frame || got_packet) ? 0 : 1; } // Allocating the output audio buffer static AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt, uint64_t channel_layout, int sample_rate, int nb_samples) { AVFrame *frame = av_frame_alloc(); int ret; if (!frame) { fprintf(stderr, "Error allocating an audio frame\n"); exit(1); } // This code give "Allocating 1 3 48000 1024" printf( "Allocating %d %d %d %d\n", sample_fmt, channel_layout, sample_rate, nb_samples); frame->format = sample_fmt; frame->channe
[FFmpeg-user] Simple question regarding probing and resetting position in C
I have the generic code to open a small file and start getting packets from it, but it seems that the probing moves the internal pointers along around 20 seconds into the file. I have tried to avio_seek (pb, 0, SEEK_SET) to reset it to the start but this has not helped. What is the correct way of resetting the opened file so i can decode from the start, joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Re: [FFmpeg-user] Simple question regarding probing and resetting position in C
> > From: Carl Eugen Hoyos >To: ffmpeg-user@ffmpeg.org >Sent: Wednesday, 1 April 2015, 11:16 >Subject: Re: [FFmpeg-user] Simple question regarding probing and resetting >position in C > > >JULIAN GARDNER btinternet.com> writes: > >> I have the generic code to open a small file and >> start getting packets from it, but it seems that >> the probing moves the internal pointers along >> around 20 seconds into the file. > >What do you mean with "internal pointers"? >(You shouldn't try to access the internal pointers.) > >When you start decoding after probing, decoding >should start with the beginning of the file. >In certain cases (like cut H.264 streams), the >initial output of the decoding may not match the >beginning of the file, there are options to >circumvent that. > >Carl Eugen > I dont want to access any internals, i want to find out why i get this scenario with small files. file 1 starts 20 seconds in, mp4 file 2 starts 27 seconds in, avi OK, i will look into this and see if I am doing anything wrong. joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] playing a stream at the correct speed from a file. help needed please
I have a thread that I am trying and failing to get to play a stream from disc as the correct rate. I have an input thread which does this in its packet loop, code is in to pause and resume the process depending on how many frames have been buffered. while (!inputSource->quit && !stop_all_tasks && av_read_frame(inputSource->fmt_ctx, &inputSource->pkt) >= 0) { int cnt; do { ret = decode_packet(&got_frame, 0, inputSource); if (ret < 0) break; inputSource->pkt.data += ret; inputSource->pkt.size -= ret; } while (!inputSource->quit && !stop_all_tasks && inputSource->pkt.size > 0); cnt = localNumberOfPackets( inputSource, VIDEO_INDEX); if( cnt>25) { do { sleep(1); cnt = localNumberOfPackets( inputSource, VIDEO_INDEX); } while( !inputSource->quit && !stop_all_tasks && cnt>15); } } } now the decode_packet does this, all standard stuff if (inputSource->pkt.stream_index == inputSource->video_stream_idx) { /* decode video frame */ ret = avcodec_decode_video2(inputSource->video_dec_ctx, frame, got_frame, &inputSource->pkt); if (ret < 0) { fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret)); return ret; } index = VIDEO_INDEX; } else if (inputSource->pkt.stream_index == inputSource->audio_stream_idx) { /* decode audio frame */ ret = avcodec_decode_audio4(inputSource->audio_dec_ctx, frame, got_frame, &inputSource->pkt); if (ret < 0) { fprintf(stderr, "Error decoding audio frame (%s)\n", av_err2str(ret)); return ret; } /* Some audio decoders decode only part of the packet, and have to be * called again with the remainder of the packet data. * Sample: fate-suite/lossless-audio/luckynight-partial.shn * Also, some decoders might over-read the packet. */ decoded = FFMIN(ret, inputSource->pkt.size); index = AUDIO_INDEX; } if( *got_frame && indexvideo_dec_ctx->time_base); else pts *= av_q2d(inputSource->audio_dec_ctx->time_base); current->frame = frame; current->pts = pts; current->next = NULL; localAddPacketToList( inputSource, index, current); } And finally where i seem to be having the problem the, video decode thread double frame_delay; double basicDelay = av_q2d(inputSource->video_dec_ctx->time_base) * inputSource->video_dec_ctx->ticks_per_frame; NextPts = PrePts = 0; gettimeofday(&start_time, NULL); start_usec = TIMEOFDAY(start_time); while( !inputSource->quit && !stop_all_tasks) { int cnt = localNumberOfPackets( inputSource, VIDEO_INDEX); if( cnt) { videoFrames *here; AVFrame *frame; int t; double pts; pthread_mutex_lock( &inputSource->list_mutex); here = inputSource->packets_list[VIDEO_INDEX]; inputSource->packets_list[VIDEO_INDEX] = here->next; frame = here->frame; pts = here->pts; pthread_mutex_unlock( &inputSource->list_mutex); // code from github, 3rd try See values at end if( !NextPts && !PrePts) { NextPts = PrePts = frame->pkt_pts; } if( frame->pkt_pts != AV_NOPTS_VALUE) { drift = frame->pkt_pts - NextPts; NextPts = ( frame->pkt_pts - PrePts) + frame->pkt_pts; Delay = NextPts - frame->pkt_pts - drift; if( Delay < 0) Delay = 0; frame_delay = Delay * 1000 * av_q2d( inputSource->video_dec_ctx->time_base); PrePts = frame->pkt_pts; } else { frame_delay = basicDelay * frame->repeat_pict * (basicDelay * 0.5); frame_delay *= 1000; } frame_delay = FFMIN( frame_delay, 200); if( inputSource->video_dec_ctx->codec_id == AV_CODEC_ID_H264) { frame_delay = FFMAX( frame_delay, 10); } printf( "Frame Display delay:%f drift:%8ld next:%8ld prev:%8ld Delay:%8ld (%d)\r\n", frame_delay, drift, NextPts, PrePts, Delay, cnt); usleep( frame_delay * 1000); if (frame->key_frame) { if (verbose) { printf("%s video_frame n:%d coded_n:%d pts:%s %f %c\n", inputSource->name, inputSource->video_frame_count, frame->display_picture
Re: [FFmpeg-user] playing a stream at the correct speed from a file. help needed please
> > From: Carl Eugen Hoyos >To: ffmpeg-user@ffmpeg.org >Sent: Thursday, 2 April 2015, 14:58 >Subject: Re: [FFmpeg-user] playing a stream at the correct speed from a >file. help needed please > > >JULIAN GARDNER btinternet.com> writes: > >> I have a thread that I am trying and failing to get >> to play a stream from disc as the correct rate. > >Did you try with ffmpeg (the application)? >There are streams that do not play with the correct >speed with FFmpeg, and in that case, there is no >issue in your software. >(The issue in FFmpeg is H264-related.) > >Carl Eugen > >___ >ffmpeg-user mailing list >ffmpeg-user@ffmpeg.org >http://ffmpeg.org/mailman/listinfo/ffmpeg-user > I checked against ffmpeg and they play correctly so its is my conversion code that is not working. on one stream the delay comes out as 16.683 when the correct delay is (1000/29.97) or 33.36 joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
[FFmpeg-user] Little help
Has anybody any code that will split an audio buffer so that the packet passed to the codec is of the right size. The problem is in this code frame = here->frame; /* convert samples from native format to destination codec format, using the resampler */ /* compute destination number of samples */ dst_nb_samples = av_rescale_rnd(swr_get_delay(inputSource->audio_swr_ctx, inputSource->audio_dec_ctx->sample_rate) + frame->nb_samples, c->sample_rate, inputSource->audio_dec_ctx->sample_rate, AV_ROUND_UP); //av_assert0(dst_nb_samples == frame->nb_samples); // printf( "rescale_rnd %d to %d\r\n", frame->nb_samples, dst_nb_samples); if( dst_nb_samples>ost->audio_frame_size) { av_frame_free(&ost->audio_frame); ost->audio_frame = alloc_audio_frame(c->sample_fmt, c->channel_layout, c->sample_rate, dst_nb_samples); ost->audio_frame_size = dst_nb_samples; } /* when we pass a frame to the encoder, it may keep a reference to it * internally; * make sure we do not overwrite it here */ ret = av_frame_make_writable(ost->audio_frame); if (ret < 0) exit(1); /* convert to destination format */ ret = swr_convert(inputSource->audio_swr_ctx, ost->audio_frame->data, dst_nb_samples, (const uint8_t **)frame->data, frame->nb_samples); if (ret < 0) { fprintf(stderr, "Error while converting\n"); exit(1); } ost->audio_frame->pts = av_rescale_q(ost->samples_count, (AVRational){1, c->sample_rate}, c->time_base); ost->samples_count += dst_nb_samples; ost->next_pts = av_rescale_q(ost->samples_count, (AVRational){1, c->sample_rate}, c->time_base); // THIS CODE IS HERE TO PROVE THE ENCODER WORKS WITH RESAMPLED DATA if(1) { int size = ost->audio_frame->nb_samples; ost->audio_frame->nb_samples = FFMIN( c->frame_size, dst_nb_samples); ret = avcodec_encode_audio2(c, &pkt, ost->audio_frame, &got_packet); ost->audio_frame->nb_samples = size; if (ret < 0) { fprintf(stderr, "Error encoding audio frame: %s\n", av_err2str(ret)); exit(1); } } if (got_packet) { ret = write_frame(oc, &c->time_base, ost->st, &pkt); if (ret < 0) { fprintf(stderr, "Error while writing audio frame: %s\n", av_err2str(ret)); exit(1); } } As you see i have to make sure the converted packet is no bigger that the allowed packet size in the encoder. My problem is the packet size before the convertor is 1024 but after conversion it is 1536, the codec (libfaac) on allows 1024 as the packet size, the above code works but i lose 1/3 of the data. So how do i split an audio buffer when the format can be anything the user chooses joolz joolz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user