Feeding FFMPEG from buffer in c code RAW H264 to MP4 wrapping, or named fifo?
i have a raw h264 stream coming in from cameras with a custom API. data gets put into a callback function in my c code. i need to wrap this as mp4. i'm using ffmpeg to do this now, but only after the h264es file has been written and closed, so very time consuming on a beaglebone-like processor. i have been trying to write this data to a named pipe and feed that to ffmpeg but can not get this to work. maybe i'm not opening/closing pipes properly, it hangs. or not specifying the piping properly for ffmpeg. is it possible to feed the buffered data more directly to ffmpeg? or, how do i set up the named pipe to work properly? first i'm opening the fifo like this g_fifoname="/tmp/fifocam1.h264"; mkfifo(g_fifoname, 0666); // make the fifos fd_fifo[ch+brd*2] = open(g_fifoname, O_RDWR); then, i'm calling ffmpeg like this, at this moment anyway. trying many things. char* execargs[]={PATH_TO_FFMPEG,"-re","-y","-framerate","30","-f","h264","-video_size","1920x1080","-i",g_fifname,"-c:v","copy","-an",pathname, (char*)0}; i probably got the ffmpeg call wrong. argh. i open the fifo first, then start ffmpeg. when streaming is stopped i close fifo's, then close ffmpeg output file. ffmpeg is so powerful and frustrating to wrangle. thanks all,
2017-05-08 23:47 GMT+02:00 abraxas1 <abraxas1@gmail.com>:
char* execargs[ {PATH_TO_FFMPEG,"-re","-y","-framerate","30", "-f","h264","-video_size","1920x1080","-i", g_fifname,"-c:v","copy","-an",pathname, (char*)0};
Test the command from the shell, remove the useless options like "f", "framerate" and "video_size" and if it doesn't work, provide the complete, uncut console output. Carl Eugen
yes, thanks carl, i went on to do just that. first i fed the buffer output to the fifo and piped that to a file. then i used this command to successfully wrap that up as an mp4 ffmpeg -frqmerate 30 -y -f h264 -i /tmp/fifocam1.h264 -c:v copy -an -video_size 1920x1080 -f mp4 fifocam1.mp4 then i jump back into my code, and try to get it all to work at once with this command (moving the -video_size to the output side of the command elliminated the video_size error) and still no joy. i think it's my sequence of events,perhaps. how to properly tell ffmpeg to close up shop? 1) mkfifo(fifoname, S_IRUSR| S_IWUSR) (the latest options im trying there) 2) open(fifoname, O_RDWR|O_NONBLOCK) (other options have been tried...) 2a) fopen pathnaem, files that ffmpeg will write to (why the heck am i doing this?) 3) launch exec thusly. char* execargs[]={PATH_TO_FFMPEG,"-loglevel","debug","-framerate","30","-y","-f","h264","-i",g_fifoname,"-c:v","copy","-an","-video_size","1920x1080","-f","mp4",pathname, (char*)0}; 4)write(fd_fifo[ch], buffer, size); in callback function that receives camera data (as h264es) 5) stop video 6)close(fd_fifo) 7) rm fifo with execv (not sure why) 8) close files that ffmpeg should be writing to (why? this is ffmpeg business) 9) kill(ffmpeg_pid, SIGTERM) (really shouldln't have to do this, i think. closing the pipe should cause ffmpeg to wrap up thigns?) ok, so let me take out the file manipulations ffmpeg should be doing. my outputs are multiplexed because i'm doing this four times. 2 video streams in 2 threads. really appreciate the help, excited to get this to work. thanks, mike Successfully opened the file. Parsing a group of options: output url /media/sd-card/orbi_0145.cam3.mp4. Applying option c:v (codec name) with argument copy. Applying option an (disable audio) with argument 1. Applying option f (force format) with argument mp4. Successfully parsed a group of options. Opening an output file: /media/sd-card/orbi_0145.cam3.mp4. Successfully opened the file. [mp4 @ 0x1101f50] Codec for stream 0 does not use global headers but container format requires global headers Output #0, mp4, to '/media/sd-card/orbi_0145.cam3.mp4': [h264 @ 0x8a6800] interrupted [h264 @ 0x8a6800] decoding for stream 0 failed [h264 @ 0x8a6800] [h264 @ 0x1002800] Metadata: encoder : Lavf56.40.101 Stream #0:0, 0, 1/1200000: Video: h264, 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080 (0x0), 1/1200000, q=2-31, 29.97 fps, 29.97 tbr, 1200k tbn, 1200k tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Could not write header for output file #0 (incorrect codec parameters ?): Immediate exit requested [AVIOContext @ 0x110aee0] Statistics: 0 seeks, 1 writeouts [AVIOContext @ 0x10f4fc0] Statistics: 32768 bytes read, 0 seeks Exiting normally, received signal 15. interrupted [h264 @ 0x1002800] decoding for stream 0 failed [h264 @ 0x1002800] After avformat_find_stream_info() pos: 26624 bytes read:32768 seeks:0 frames:3 Input #0, h264, from '/tmp/fifocam4.h264': Duration: N/A, bitrate: N/A Stream #0:0, 3, 1/1200000: Video: h264 (Main), 1 reference frame, yuv420p(tv, left), 1920x1080 (1920x1088), 1001/60000, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc Successfully opened the file. Parsing a group of options: output url /media/sd-card/orbi_0145.cam4.mp4. Applying option c:v (codec name) with argument copy. Applying option an (disable audio) with argument 1. Applying option f (force format) with argument mp4. After avformat_find_stream_info() pos: 18432 bytes read:32768 seeks:0 frames:3 Input #0, h264, from '/tmp/fifocam1.h264': Successfully parsed a group of options. Opening an output file: /media/sd-card/orbi_0145.cam4.mp4. Successfully opened the file. Duration: N/A, bitrate: N/A Stream #0:0, 3, 1/1200000: Video: h264 (Main), 1 reference frame, yuv420p(tv, left), 1920x1080 (1920x1088), 1001/60000, 29.97 fps, 29.97 tbr, [mp4 @ 0x8bbf50] 1200k tbn, 59.94 tbc Successfully opened the file. Parsing a group of options: output url /media/sd-card/orbi_0145.cam1.mp4. Codec for stream 0 does not use global headers but container format requires global headers On Tue, May 9, 2017 at 6:28 AM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
2017-05-08 23:47 GMT+02:00 abraxas1 <abraxas1@gmail.com>:
char* execargs[ {PATH_TO_FFMPEG,"-re","-y","-framerate","30", "-f","h264","-video_size","1920x1080","-i", g_fifname,"-c:v","copy","-an",pathname, (char*)0};
Test the command from the shell, remove the useless options like "f", "framerate" and "video_size" and if it doesn't work, provide the complete, uncut console output.
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-request@ffmpeg.org with subject "unsubscribe".
ok, i removed the opening and the closing of the files that ffmpeg is opening in it's own process. (they were legacy...) now it seems to proceed through the recording nicely, with no output fro ffmpeg until recording stops. i have to investigate just where the problem starts, but probably with closing the fifo's which tell ffmpeg to finish the stream and close it's output file(?) and results in this. again, this is happening across 4 streams and the output from the four ffmpegs is rather convoluted. any thoughts? i must be so close to this working, i hope. [h264 @ 0x10f8320] bytestream overread -11 [h264 @ 0x10f8320] error while decoding MB 52 40, bytestream -11 [h264 @ 0x10f8320] concealing 3357 DC, 3357 AC, 3357 MV errors in I frame [h264 @ 0xe3320] bytestream overread -46 [h264 @ 0xe3320] error while decoding MB 26 40, bytestream -46 [h264 @ 0xe3320] [h264 @ 0x621320] concealing 3383 DC, 3383 AC, 3383 MV errors in I frame bytestream overread -12 [h264 @ 0x621320] error while decoding MB 24 43, bytestream -12 [h264 @ 0x621320] concealing 3025 DC, 3025 AC, 3025 MV errors in I frame [h264 @ 0x10f8320] Frame num gap 5 3 **********************IN THREAD stopBlink turned to 1 [h264 @ 0x1087320] bytestream overread -7 [h264 @ 0x1087320] error while decoding MB 27 13, bytestream -7 [h264 @ 0x1087320] [h264 @ 0x621320] concealing 6622 DC, 6622 AC, 6622 MV errors in P frame [h264 @ 0xe3320] Frame num gap 8 6 Frame num gap 5 3 [h264 @ 0x10f8320] bytestream overread -4 [h264 @ 0x10f8320] bytestream overread -8 [h264 @ 0x10f8320] error while decoding MB 31 20, bytestream -8 [h264 @ 0x10f8320] concealing 5778 DC, 5778 AC, 5778 MV errors in P frame [h264 @ 0xe3320] bytestream overread -8 [h264 @ 0xe3320] error while decoding MB 68 12, bytestream -8 [h264 @ 0xe3320] concealing 6701 DC, 6701 AC, 6701 MV errors in P frame [h264 @ 0x1087320] Frame num gap 6 4 [h264 @ 0x1087320] bytestream overread -4 Last message repeated 5 times [h264 @ 0x1087320] bytestream overread -10 [h264 @ 0x1087320] error while decoding MB 58 14, bytestream -10 [h264 @ 0x1087320] concealing 6471 DC, 6471 AC, 6471 MV errors in P frame On Tue, May 9, 2017 at 11:08 AM abraxas1 <abraxas1@gmail.com> wrote:
yes, thanks carl, i went on to do just that. first i fed the buffer output to the fifo and piped that to a file. then i used this command to successfully wrap that up as an mp4 ffmpeg -frqmerate 30 -y -f h264 -i /tmp/fifocam1.h264 -c:v copy -an -video_size 1920x1080 -f mp4 fifocam1.mp4
then i jump back into my code, and try to get it all to work at once with this command (moving the -video_size to the output side of the command elliminated the video_size error) and still no joy. i think it's my sequence of events,perhaps. how to properly tell ffmpeg to close up shop? 1) mkfifo(fifoname, S_IRUSR| S_IWUSR) (the latest options im trying there) 2) open(fifoname, O_RDWR|O_NONBLOCK) (other options have been tried...) 2a) fopen pathnaem, files that ffmpeg will write to (why the heck am i doing this?) 3) launch exec thusly. char* execargs[]={PATH_TO_FFMPEG,"-loglevel","debug","-framerate","30","-y","-f","h264","-i",g_fifoname,"-c:v","copy","-an","-video_size","1920x1080","-f","mp4",pathname, (char*)0}; 4)write(fd_fifo[ch], buffer, size); in callback function that receives camera data (as h264es) 5) stop video 6)close(fd_fifo) 7) rm fifo with execv (not sure why) 8) close files that ffmpeg should be writing to (why? this is ffmpeg business) 9) kill(ffmpeg_pid, SIGTERM) (really shouldln't have to do this, i think. closing the pipe should cause ffmpeg to wrap up thigns?)
ok, so let me take out the file manipulations ffmpeg should be doing. my outputs are multiplexed because i'm doing this four times. 2 video streams in 2 threads. really appreciate the help, excited to get this to work. thanks, mike
Successfully opened the file. Parsing a group of options: output url /media/sd-card/orbi_0145.cam3.mp4. Applying option c:v (codec name) with argument copy. Applying option an (disable audio) with argument 1. Applying option f (force format) with argument mp4. Successfully parsed a group of options. Opening an output file: /media/sd-card/orbi_0145.cam3.mp4. Successfully opened the file. [mp4 @ 0x1101f50] Codec for stream 0 does not use global headers but container format requires global headers Output #0, mp4, to '/media/sd-card/orbi_0145.cam3.mp4': [h264 @ 0x8a6800] interrupted [h264 @ 0x8a6800] decoding for stream 0 failed [h264 @ 0x8a6800] [h264 @ 0x1002800] Metadata: encoder : Lavf56.40.101 Stream #0:0, 0, 1/1200000: Video: h264, 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080 (0x0), 1/1200000, q=2-31, 29.97 fps, 29.97 tbr, 1200k tbn, 1200k tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Could not write header for output file #0 (incorrect codec parameters ?): Immediate exit requested [AVIOContext @ 0x110aee0] Statistics: 0 seeks, 1 writeouts [AVIOContext @ 0x10f4fc0] Statistics: 32768 bytes read, 0 seeks Exiting normally, received signal 15. interrupted [h264 @ 0x1002800] decoding for stream 0 failed [h264 @ 0x1002800] After avformat_find_stream_info() pos: 26624 bytes read:32768 seeks:0 frames:3 Input #0, h264, from '/tmp/fifocam4.h264': Duration: N/A, bitrate: N/A Stream #0:0, 3, 1/1200000: Video: h264 (Main), 1 reference frame, yuv420p(tv, left), 1920x1080 (1920x1088), 1001/60000, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc Successfully opened the file. Parsing a group of options: output url /media/sd-card/orbi_0145.cam4.mp4. Applying option c:v (codec name) with argument copy. Applying option an (disable audio) with argument 1. Applying option f (force format) with argument mp4. After avformat_find_stream_info() pos: 18432 bytes read:32768 seeks:0 frames:3 Input #0, h264, from '/tmp/fifocam1.h264': Successfully parsed a group of options. Opening an output file: /media/sd-card/orbi_0145.cam4.mp4. Successfully opened the file. Duration: N/A, bitrate: N/A Stream #0:0, 3, 1/1200000: Video: h264 (Main), 1 reference frame, yuv420p(tv, left), 1920x1080 (1920x1088), 1001/60000, 29.97 fps, 29.97 tbr, [mp4 @ 0x8bbf50] 1200k tbn, 59.94 tbc Successfully opened the file. Parsing a group of options: output url /media/sd-card/orbi_0145.cam1.mp4. Codec for stream 0 does not use global headers but container format requires global headers
On Tue, May 9, 2017 at 6:28 AM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
2017-05-08 23:47 GMT+02:00 abraxas1 <abraxas1@gmail.com>:
char* execargs[ {PATH_TO_FFMPEG,"-re","-y","-framerate","30", "-f","h264","-video_size","1920x1080","-i", g_fifname,"-c:v","copy","-an",pathname, (char*)0};
Test the command from the shell, remove the useless options like "f", "framerate" and "video_size" and if it doesn't work, provide the complete, uncut console output.
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-request@ffmpeg.org with subject "unsubscribe".
On Tue, May 09, 2017 at 22:23:29 +0000, abraxas1 wrote:
ok, i removed the opening and the closing of the files that ffmpeg is opening in it's own process. (they were legacy...)
They were wrong. ffmpeg does that just fine. ;-)
now it seems to proceed through the recording nicely, with no output fro ffmpeg until recording stops.
If you mean the console output: You probably need to flush, in order to see it, or make it unbuffered. (I think your program interacting with the terminal may be buffering something like e.g. 4k of the output - but I may be wrong.)
starts, but probably with closing the fifo's which tell ffmpeg to finish the stream and close it's output file(?)
Yes, if the input fifo is closed, ffmpeg should detect EOF and stop encoding.
and results in this. again, this is happening across 4 streams and the output from the four ffmpegs is rather convoluted.
If you don't want the output to be convoluted, why don't you - start off with one ffmpeg first, or - log to separate outputs (e.g. with the "-report" option) - and stop omitting parts of ffmpeg's output from your reports to the list! Cheers, Moritz
-report is very cool, sorry for wasting your attention, and mine, with terrible logs. i have piped the raw h264 to a file and this command converts is successfully. ffmpeg -report -re -framerate 30 -y -f h264 -i orbi_0148.cam1.h264 -c:v copy -an -video_size 1920x1080 -f mp4 orbi_0148.cam1-1.mp4 i then try to launch this command from my program with the same options, and also with many several options. my program doesn't mess with ffmpegs output files anymore. i close the fifos at the end of video recording and that's all. and don't get any file created and get this output, which i don't understand at all. (the successful command line output follows the execv() output) thanks, (execv output with options -report -y -i /tmp/fifocam3.h264 -c:v copy -an -video_size 1920x1080 -f mp4 /media/sd-card/orbi_0140.cam3.mp4) root@arm:/home/orbi# cat ffmpeg-20170511-001941.log ffmpeg started on 2017-05-11 at 00:19:41 Report written to "ffmpeg-20170511-001941.log" Command line: /usr/bin/ffmpeg -report -y -i /tmp/fifocam3.h264 -c:v copy -an -video_size 1920x1080 -f mp4 /media/sd-card/orbi_0140.cam3.mp4 ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 5.4.0 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11gr libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Splitting the commandline. Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option '-i' ... matched as input url with argument '/tmp/fifocam3.h264'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'. Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'. Reading option '-video_size' ... matched as AVOption 'video_size' with argument '1920x1080'. Reading option '-f' ... matched as option 'f' (force format) with argument 'mp4'. Reading option '/media/sd-card/orbi_0140.cam3.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option report (generate a report) with argument 1. Applying option y (overwrite output files) with argument 1. Successfully parsed a group of options. Parsing a group of options: input url /tmp/fifocam3.h264. Successfully parsed a group of options. Opening an input file: /tmp/fifocam3.h264. [h264 @ 0xf249a0] Format h264 probed with size=2048 and score=51 [h264 @ 0xf249a0] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 [h264 @ 0xf25460] Current profile doesn't provide more RBSP data in PPS, skipping [h264 @ 0xf25460] bytestream overread -4 [h264 @ 0xf25460] bytestream overread -4 [h264 @ 0xf25460] bytestream overread -4 [h264 @ 0xf25460] bytestream overread -4 [h264 @ 0xf25460] bytestream overread -10 [h264 @ 0xf25460] error while decoding MB 112 28, bytestream -10 [h264 @ 0xf25460] concealing 4737 DC, 4737 AC, 4737 MV errors in P frame [h264 @ 0xf25460] Frame num gap 7 5 /////// successful command line run \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ root@arm:/home/orbi# ffmpeg -report -re -framerate 30 -y -f h264 -i orbi_0148.cam1.h264 -c:v copy -an -video_size 1920x1080 -f mp4 orbi_0148.cam1-1.mp4 root@arm:/home/orbi# cat ffmpeg-20170511-002629.log ffmpeg started on 2017-05-11 at 00:26:29 Report written to "ffmpeg-20170511-002629.log" Command line: ffmpeg -report -re -framerate 30 -y -f h264 -i orbi_0148.cam1.h264 -c:v copy -an -video_size 1920x1080 -f mp4 orbi_0148.cam1-1.mp4 ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 5.4.0 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11gr libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Splitting the commandline. Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'. Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'. Reading option '-framerate' ... matched as AVOption 'framerate' with argument '30'. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option '-f' ... matched as option 'f' (force format) with argument 'h264'. Reading option '-i' ... matched as input url with argument 'orbi_0148.cam1.h264'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'. Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'. Reading option '-video_size' ... matched as AVOption 'video_size' with argument '1920x1080'. Reading option '-f' ... matched as option 'f' (force format) with argument 'mp4'. Reading option 'orbi_0148.cam1-1.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option report (generate a report) with argument 1. Applying option y (overwrite output files) with argument 1. Successfully parsed a group of options. Parsing a group of options: input url orbi_0148.cam1.h264. Applying option re (read input at native frame rate) with argument 1. Applying option f (force format) with argument h264. Successfully parsed a group of options. Opening an input file: orbi_0148.cam1.h264. [h264 @ 0x848a20] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 [h264 @ 0x8515b0] Current profile doesn't provide more RBSP data in PPS, skipping [h264 @ 0x8515b0] Current profile doesn't provide more RBSP data in PPS, skipping [h264 @ 0x848a20] max_analyze_duration 5000000 reached at 5005000 microseconds st:0 [h264 @ 0x848a20] After avformat_find_stream_info() pos: 3773440 bytes read:3801088 seeks:0 frames:152 Input #0, h264, from 'orbi_0148.cam1.h264': Duration: N/A, bitrate: N/A Stream #0:0, 152, 1/1200000: Video: h264 (Main), yuv420p(tv), 1920x1080, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc Successfully opened the file. Parsing a group of options: output url orbi_0148.cam1-1.mp4. Applying option c:v (codec name) with argument copy. Applying option an (disable audio) with argument 1. Applying option f (force format) with argument mp4. Successfully parsed a group of options. Opening an output file: orbi_0148.cam1-1.mp4. Successfully opened the file. [mp4 @ 0x8fb230] Codec for stream 0 does not use global headers but container format requires global headers Output #0, mp4, to 'orbi_0148.cam1-1.mp4': Metadata: encoder : Lavf56.40.101 Stream #0:0, 0, 1/1200000: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=2-31, 29.97 fps, 29.97 tbr, 1200k tbn, 1200k tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [NULL @ 0x8515b0] Current profile doesn't provide more RBSP data in PPS, skipping No more output streams to write to, finishing.e=00:00:08.64 bitrate=5887.7kbits/s frame= 270 fps= 30 q=-1.0 Lsize= 6443kB time=00:00:08.97 bitrate=5880.6kbits/s video:6440kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.056839% Input file #0 (orbi_0148.cam1.h264): Input stream #0:0 (video): 270 packets read (6594052 bytes); Total: 270 packets (6594052 bytes) demuxed Output file #0 (orbi_0148.cam1-1.mp4): Output stream #0:0 (video): 270 packets muxed (6594052 bytes); Total: 270 packets (6594052 bytes) muxed 0 frames successfully decoded, 0 decoding errors [AVIOContext @ 0x931650] Statistics: 34 seeks, 308 writeouts [AVIOContext @ 0x851190] Statistics: 6594052 bytes read, 0 seeks On Wed, May 10, 2017 at 6:43 AM Moritz Barsnick <barsnick@gmx.net> wrote:
On Tue, May 09, 2017 at 22:23:29 +0000, abraxas1 wrote:
ok, i removed the opening and the closing of the files that ffmpeg is opening in it's own process. (they were legacy...)
They were wrong. ffmpeg does that just fine. ;-)
now it seems to proceed through the recording nicely, with no output fro ffmpeg until recording stops.
If you mean the console output: You probably need to flush, in order to see it, or make it unbuffered. (I think your program interacting with the terminal may be buffering something like e.g. 4k of the output - but I may be wrong.)
starts, but probably with closing the fifo's which tell ffmpeg to finish the stream and close it's output file(?)
Yes, if the input fifo is closed, ffmpeg should detect EOF and stop encoding.
and results in this. again, this is happening across 4 streams and the output from the four ffmpegs is rather convoluted.
If you don't want the output to be convoluted, why don't you - start off with one ffmpeg first, or - log to separate outputs (e.g. with the "-report" option) - and stop omitting parts of ffmpeg's output from your reports to the list!
Cheers, Moritz _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
2017-05-09 20:08 GMT+02:00 abraxas1 <abraxas1@gmail.com>:
yes, thanks carl, i went on to do just that. first i fed the buffer output to the fifo and piped that to a file.
The ffmpeg command line tool should be able to read from the fifo to allow you testing without the call to exec().
Successfully opened the file.
Do not cut the console output if you request help here. Please do not top-post here, Carl Eugen
participants (3)
-
abraxas1 -
Carl Eugen Hoyos -
Moritz Barsnick