RTSP Streams Often Fail with 404 on DESCRIBE method - nest-device-access
Stream URLs generated by the API frequently fail with a 404 code when a client tries to execute the DESCRIBE method. The behaviour is random even for the same stream url over time. Below is an example of calling ffprobe on an RTSPS stream URL returned from the API. Each request is made approximately one second apart after receiving the URL. Again, this is the same URL each time. The results are
DESCRIBE returns 404
DESCRIBE returns 404
success
success but with empty response
success
This would seem to indicate it is not a fault with ffprobe/ffplay/ffmpeg but some kind of issue with the API, perhaps the streams aren't actually ready when the API returns the URL?
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[rtsp # 0x7faa72808e00] method DESCRIBE failed: 404 Not Found
rtsps://<stream url>: Server returned 404 Not Found
user#user ~ % ffprobe "rtsps://<stream url>"
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[rtsp # 0x7fe75b009400] method DESCRIBE failed: 404 Not Found
rtsps://<stream url>: Server returned 404 Not Found
user#user ~ % ffprobe "rtsps://<stream urll>"
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, rtsp, from 'rtsps://<stream url>':
Metadata:
title : SDM
Duration: N/A, start: -2.877000, bitrate: N/A
Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp
Stream #0:1: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 15 fps, 15 tbr, 90k tbn, 30 tbc
user#user ~ % ffprobe "<stream url>"
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, rtsp, from <stream url>':
Metadata:
title : SDM
Duration: N/A, bitrate: N/A
user#user ~ % ffprobe "<stream url>"
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, rtsp, from 'rtsps://<stream url>':
Metadata:
title : SDM
Duration: N/A, start: -1.903000, bitrate: N/A
Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp
Stream #0:1: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 15 fps, 15 tbr, 90k tbn, 30 tbc
user#user ~ % ```
Related
How to create animation in html output using R Markdown
Here is the list of things I've tried. --- title: "test_gif" output: html_document --- ``` {r, animation.hook='gifski', dev='png', interval=0.2} library(gganimate) ggplot(airquality, aes(Day, Temp, group = Month)) + geom_line() + transition_reveal(Month) ``` Error: Quitting from lines 8-12 (test_gif.Rmd) Error in hook_animation(options)(x, options) : To use hook_gifski(), the code chunk must generate 'png' images instead of 'gif'. Calls: ... hook_plot -> hook_plot_md_base -> hook_plot_html -> Execution halted Even though, I used dev = 'png' as mentioned here https://yihui.name/en/2018/08/gifski-knitr/, I couldn't able to make it work. Then I've tried using FFmpeg renderer --- title: "test_gif" output: html_document --- ```{r, animation.hook='ffmpeg', interval=0.2} library(gganimate) ggplot(airquality, aes(Day, Temp, group = Month)) + geom_line() + transition_reveal(Month) -> p animate(p) ``` Error: executing: ffmpeg -y -r 5 -i test_gif_files/figure-html/unnamed-chunk-1-%d.gif -b:v 1M -crf 10 test_gif_files/figure-html/unnamed-chunk-1.webm ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers built with Apple LLVM version 10.0.0 (clang-1000.11.45.5) configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-12.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-12.0.1.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 test_gif_files/figure-html/unnamed-chunk-1-%d.gif: No such file or directory |.................................................................| 100% ordinary text without R code output file: test_gif.knit.md /usr/local/bin/pandoc +RTS -K512m -RTS test_gif.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash+smart --output test_gif.html --email-obfuscation none --self-contained --standalone --section-divs --template /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /var/folders/pv/cs874rmn7dj9n08xdyc7s3nm0000gn/T//RtmpOqkC3V/rmarkdown-str28173033d049.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --lua-filter /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rmarkdown/rmd/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rmarkdown/rmd/lua/latex-div.lua File test_gif_files/figure-html/unnamed-chunk-1.webm not found in resource path Error: pandoc document conversion failed with error 99 Execution halted Then I followed this method, to save the gif using gifski::save_gif and then display in a subsequent chunk using include_graphics. https://community.rstudio.com/t/make-an-rstudio-notebook-inline-animation-that-loops-with-gganimate/27489/2 --- title: "test_gif" output: html_document --- ```{r} library(gganimate) library(gifski) ggplot(airquality, aes(Day, Temp, group = Month)) + geom_line() + transition_reveal(Month) -> p animate(p) ``` ```{r, animation.hook='gifski', interval = 0.2} p ``` Error(same): Quitting from lines 18-19 (test_gif.Rmd) Error in hook_animation(options)(x, options) : To use hook_gifski(), the code chunk must generate 'png' images instead of 'gif'. Calls: ... hook_plot -> hook_plot_md_base -> hook_plot_html -> Execution halted My end goal is to create animation in the final html document without producing any temporary files in-between. I would be happy even if there is any other alternative method to make this work.
With the gganimate package, you don't need to set the chunk option animation.hook. This is enough: ```{r, dev='png', interval=0.2} library(gganimate) ggplot(airquality, aes(Day, Temp, group = Month)) + geom_line() + transition_reveal(Month) ```
What is the format of "{123, affdsf, 223, 22, dgbwa, 33333}"?
I have the following format, please advise how to convert it to a list in R? "{1948, 2507, 2510, 7030, 7110, 9009, 00027, 00206, 00399, 00717, 00814, 00828, 00848, 00917, 01050, 01105, 01144, 02130, 02768, 03037, 03752, 03754, 04070, 04110, 05050, 05255, 05289, 05564, 05595, 06100, 06330, 06671, 07041, 07119, 07137, 07273, 07313, 07454, 07871, 08104, 08714, 08726, 08995, 09059, 09073, 09525, 09949, 09981, 10092, 10439, 10782, 11185, 11507, 11712, 11806, 11858, 11980, 12067, 12113, 12139, 12643, 13820, 14534, 15007, 15014, 15549, 15953, 16151, 16174, 16634, 16733, 16888, 17111, 17207, 17377, 17721, 17900, 18118, 18400, 18686, 18880, 19080, 19342, 19444, 19772, 19790, 19891, 20091, 20245, 20402, 20811, 21114, 21345, 21811, 21881, 22222, 22311, 22320, 22831, 22969, 23251, 23572, 23734, 23862, 23889, 24034, 24463, 25172, 25688, 26143, 26221, 26803, 26850, 26898, 27497, 28291, 28343, 29411, 29419, 30024, 30561, 30923, 31345, 31351, 31555, 31927, 32198, 32861, 33020, 33040, 33095, 33188, 33311, 33368, 33377, 33475, 33519, 33574, 33592, 34207, 34235, 34272, 34484, 34854, 34872, 34875, 34876, 34880, 35222, 35292, 35344, 36177, 36266, 37038, 37060, 37548, 37686, 37700, 38139, 39368, 39369, 39633, 40132, 40698, 40704, 40744, 40819, 41311, 41971, 42102, 42616, 43055, 43211, 43234, 43428, 43494, 43934, 44117, 44252, 44272, 44301, 44336, 44619, 44866, 44888, 45049, 45197, 45412, 45718, 46694, 46736, 47000, 48046, 48540, 49078, 49109, 49216, 49388, 49464, 50056, 50155, 50217, 50477, 50692, 51122, 51445, 51946, 52475, 52537, 52982, 54011, 54031, 54160, 54963, 55000, 55537, 56080, 56163, 56282, 56760, 56787, 57102, 57727, 57871, 58101, 58558, 58882, 59902, 60225, 60397, 60501, 60619, 60703, 60890, 61075, 61894, 61944, 62322, 62337, 62380, 62413, 62729, 62766, 62923, 63010, 63234, 63977, 64127, 65359, 65428, 65542, 65750, 65863, 66184, 66636, 66712, 67201, 67439, 67953, 68133, 68854, 69251, 69959, 70107, 70725, 70768, 71081, 71099, 71948, 72013, 72377, 72400, 72420, 72735, 73000, 73015, 73142, 73223, 73455, 73717, 74049, 74492, 74854, 74941, 75142, 75399, 75464, 75587, 75618, 75642, 75887, 76357, 76651, 77199, 77302, 77456, 77579, 77601, 77649, 77668, 77694, 77745, 78006, 78010, 78178, 78335, 78656, 78729, 78808, 78824, 78844, 78945, 79416, 79471, 79915, 80077, 80111, 80189, 80262, 80409, 80470, 80529, 80539, 80838, 81272, 81513, 81658, 81740, 81743, 81762, 81843, 82001, 82070, 82106, 82342, 82472, 82719, 83670, 84009, 84151, 84299, 84430, 84450, 84460, 84945, 86411, 86443, 86446, 86668, 86942, 87286, 87317, 87624, 87785, 88023, 88517, 88696, 88787, 88868, 88977, 89206, 90108, 90440, 90734, 90802, 90849, 90920, 90931, 91011, 91031, 91133, 91777, 91949, 92162, 92494, 93012, 93172, 94300, 94517, 95142, 95410, 95559, 95859, 96112, 97255, 97787, 97986, 98240, 98817, 99050, 99198, 99222, 99241, 99295, 99326, 99335, 99503, 99603, 99643, 99803, 99968}" THIS IS NOT A DUPLICATE OF convert json to list in a vectorized way in R IT'S COMPLETELY DIFFERENT BECAUSE THE FORMAT IS ABSOLUTELY DIFFERENT.
Try this one line code: as.numeric(sapply(strsplit(substr(j,2,nchar(j)-1),split = ","),trimws)) [1] 1948 2507 2510 7030 7110 9009 27 206 399 717 814 828 848 917 1050 1105 1144 [18] 2130 2768 3037 3752 3754 4070 4110 5050 5255 5289 5564 5595 6100 6330 6671 7041 7119 [35] 7137 7273 7313 7454 7871 8104 8714 8726 8995 9059 9073 9525 9949 9981 10092 10439 10782 [52] 11185 11507 11712 11806 11858 11980 12067 12113 1213 .. Your input: j<-"{1948, 2507, 2510, 7030, 7110, 9009, 00027, 00206, 00399, 00717, 00814, 00828, 00848, 00917, 01050, 01105, 01144, 02130, 02768, 03037, 03752, 03754, 04070, 04110, 05050, 05255, 05289, 05564, 05595, 06100, 06330, 06671, 07041, 07119, 07137, 07273, 07313, 07454, 07871, 08104, 08714, 08726, 08995, 09059, 09073, 09525, 09949, 09981, 10092, 10439, 10782, 11185, 11507, 11712, 11806, 11858, 11980, 12067, 12113, 12139, 12643, 13820, 14534, 15007, 15014, 15549, 15953, 16151, 16174, 16634, 16733, 16888, 17111, 17207, 17377, 17721, 17900, 18118, 18400, 18686, 18880, 19080, 19342, 19444, 19772, 19790, 19891, 20091, 20245, 20402, 20811, 21114, 21345, 21811, 21881, 22222, 22311, 22320, 22831, 22969, 23251, 23572, 23734, 23862, 23889, 24034, 24463, 25172, 25688, 26143, 26221, 26803, 26850, 26898, 27497, 28291, 28343, 29411, 29419, 30024, 30561, 30923, 31345, 31351, 31555, 31927, 32198, 32861, 33020, 33040, 33095, 33188, 33311, 33368, 33377, 33475, 33519, 33574, 33592, 34207, 34235, 34272, 34484, 34854, 34872, 34875, 34876, 34880, 35222, 35292, 35344, 36177, 36266, 37038, 37060, 37548, 37686, 37700, 38139, 39368, 39369, 39633, 40132, 40698, 40704, 40744, 40819, 41311, 41971, 42102, 42616, 43055, 43211, 43234, 43428, 43494, 43934, 44117, 44252, 44272, 44301, 44336, 44619, 44866, 44888, 45049, 45197, 45412, 45718, 46694, 46736, 47000, 48046, 48540, 49078, 49109, 49216, 49388, 49464, 50056, 50155, 50217, 50477, 50692, 51122, 51445, 51946, 52475, 52537, 52982, 54011, 54031, 54160, 54963, 55000, 55537, 56080, 56163, 56282, 56760, 56787, 57102, 57727, 57871, 58101, 58558, 58882, 59902, 60225, 60397, 60501, 60619, 60703, 60890, 61075, 61894, 61944, 62322, 62337, 62380, 62413, 62729, 62766, 62923, 63010, 63234, 63977, 64127, 65359, 65428, 65542, 65750, 65863, 66184, 66636, 66712, 67201, 67439, 67953, 68133, 68854, 69251, 69959, 70107, 70725, 70768, 71081, 71099, 71948, 72013, 72377, 72400, 72420, 72735, 73000, 73015, 73142, 73223, 73455, 73717, 74049, 74492, 74854, 74941, 75142, 75399, 75464, 75587, 75618, 75642, 75887, 76357, 76651, 77199, 77302, 77456, 77579, 77601, 77649, 77668, 77694, 77745, 78006, 78010, 78178, 78335, 78656, 78729, 78808, 78824, 78844, 78945, 79416, 79471, 79915, 80077, 80111, 80189, 80262, 80409, 80470, 80529, 80539, 80838, 81272, 81513, 81658, 81740, 81743, 81762, 81843, 82001, 82070, 82106, 82342, 82472, 82719, 83670, 84009, 84151, 84299, 84430, 84450, 84460, 84945, 86411, 86443, 86446, 86668, 86942, 87286, 87317, 87624, 87785, 88023, 88517, 88696, 88787, 88868, 88977, 89206, 90108, 90440, 90734, 90802, 90849, 90920, 90931, 91011, 91031, 91133, 91777, 91949, 92162, 92494, 93012, 93172, 94300, 94517, 95142, 95410, 95559, 95859, 96112, 97255, 97787, 97986, 98240, 98817, 99050, 99198, 99222, 99241, 99295, 99326, 99335, 99503, 99603, 99643, 99803, 99968}" This code removes first and last character of the string ("{" and "}" characters), splits values by "," and removes whitespaces using trimws. After that it moves the format to number.
If it happens your data actually is json, stick with the rjson package. This answer is assuming your data is not json (since rjson::fromjson throws an error on your data) Try: string <- "{1948, 2507, 2510, 7030, 7110, 9009, 00027, 00206, 00399, 00717, 00814, 00828, 00848, 00917, 01050, 01105, 01144, 02130, 02768, 03037, 03752, 03754, 04070, 04110, 05050, 05255, 05289, 05564, 05595, 06100, 06330, 06671, 07041, 07119, 07137, 07273, 07313, 07454, 07871, 08104, 08714, 08726, 08995, 09059, 09073, 09525, 09949, 09981, 10092, 10439, 10782, 11185, 11507, 11712, 11806, 11858, 11980, 12067, 12113, 12139, 12643, 13820, 14534, 15007, 15014, 15549, 15953, 16151, 16174, 16634, 16733, 16888, 17111, 17207, 17377, 17721, 17900, 18118, 18400, 18686, 18880, 19080, 19342, 19444, 19772, 19790, 19891, 20091, 20245, 20402, 20811, 21114, 21345, 21811, 21881, 22222, 22311, 22320, 22831, 22969, 23251, 23572, 23734, 23862, 23889, 24034, 24463, 25172, 25688, 26143, 26221, 26803, 26850, 26898, 27497, 28291, 28343, 29411, 29419, 30024, 30561, 30923, 31345, 31351, 31555, 31927, 32198, 32861, 33020, 33040, 33095, 33188, 33311, 33368, 33377, 33475, 33519, 33574, 33592, 34207, 34235, 34272, 34484, 34854, 34872, 34875, 34876, 34880, 35222, 35292, 35344, 36177, 36266, 37038, 37060, 37548, 37686, 37700, 38139, 39368, 39369, 39633, 40132, 40698, 40704, 40744, 40819, 41311, 41971, 42102, 42616, 43055, 43211, 43234, 43428, 43494, 43934, 44117, 44252, 44272, 44301, 44336, 44619, 44866, 44888, 45049, 45197, 45412, 45718, 46694, 46736, 47000, 48046, 48540, 49078, 49109, 49216, 49388, 49464, 50056, 50155, 50217, 50477, 50692, 51122, 51445, 51946, 52475, 52537, 52982, 54011, 54031, 54160, 54963, 55000, 55537, 56080, 56163, 56282, 56760, 56787, 57102, 57727, 57871, 58101, 58558, 58882, 59902, 60225, 60397, 60501, 60619, 60703, 60890, 61075, 61894, 61944, 62322, 62337, 62380, 62413, 62729, 62766, 62923, 63010, 63234, 63977, 64127, 65359, 65428, 65542, 65750, 65863, 66184, 66636, 66712, 67201, 67439, 67953, 68133, 68854, 69251, 69959, 70107, 70725, 70768, 71081, 71099, 71948, 72013, 72377, 72400, 72420, 72735, 73000, 73015, 73142, 73223, 73455, 73717, 74049, 74492, 74854, 74941, 75142, 75399, 75464, 75587, 75618, 75642, 75887, 76357, 76651, 77199, 77302, 77456, 77579, 77601, 77649, 77668, 77694, 77745, 78006, 78010, 78178, 78335, 78656, 78729, 78808, 78824, 78844, 78945, 79416, 79471, 79915, 80077, 80111, 80189, 80262, 80409, 80470, 80529, 80539, 80838, 81272, 81513, 81658, 81740, 81743, 81762, 81843, 82001, 82070, 82106, 82342, 82472, 82719, 83670, 84009, 84151, 84299, 84430, 84450, 84460, 84945, 86411, 86443, 86446, 86668, 86942, 87286, 87317, 87624, 87785, 88023, 88517, 88696, 88787, 88868, 88977, 89206, 90108, 90440, 90734, 90802, 90849, 90920, 90931, 91011, 91031, 91133, 91777, 91949, 92162, 92494, 93012, 93172, 94300, 94517, 95142, 95410, 95559, 95859, 96112, 97255, 97787, 97986, 98240, 98817, 99050, 99198, 99222, 99241, 99295, 99326, 99335, 99503, 99603, 99643, 99803, 99968}" string as list of characters: string_as_list_char <- as.list(strsplit(gsub('\\{|\\}', '', string), ", "))[[1]] or converted to numeric: string_as_list_num <- as.list(as.numeric(strsplit(gsub('\\{|\\}', '', string), ", ")[[1]]))
Print lines after grep till next pattern
I have a file in the form (Input_fasta.txt) >tr|A0A089QH62|A0A089QH62_MYCTU Histidine kinase OS=Mycobacterium tuberculosis (strain ATCC 25618 / H37Rv) GN=LH57_00865 PE=4 SV=1 MTATASGIAATAPNCGEASINDVPIAESERRYLGARSASEYGQEIPLW >tr|I6WXB4|I6WXB4_MYCTU 30S ribosomal protein S6 OS=Mycobacterium tuberculosis (strain ATCC 25618 / H37Rv) GN=rpsF PE=3 SV=1 MRPYEIMVILDPTLDERTVAPSLETFLNVVRKDGGKVEKVDIWGKRRLAYEIAKHAEGIY VVIDVKAAPATVSELDRQLSLNESVLRTKVMRTDKH >tr|A0A089SBT4|A0A089SBT4_MYCTU Glycosyl transferase OS=Mycobacterium tuberculosis (strain ATCC 25618 / H37Rv) GN=LH57_19775 PE=4 SV=1 MDTETHYSDVWVVIPAFNEAAVIGKVVTDVRSVFDHVVCVDDGSTDGTGDIARRSGAHLV RHPINLGQGAAIQTGIEYARKQPGAQVFATFDGDGQHRVKDVAAMVDRLGAGDVDVVIGT RFGRPVGKASASRPPLMKRIVLQTGARLSRRGRRLGLTDTNNGLRVFNKTVADGLNITMS GMSHATEFIMLIAENHWRVAEEPVEVLYTEYSKSKGQPLLNGVNIIFDGFLRGRMPR >tr|A0A089QKT1|A0A089QKT1_MYCTU TetR family transcriptional regulator OS=Mycobacterium tuberculosis (strain ATCC 25618 / H37Rv) GN=LH57_00800 PE=4 SV=1 MSLTAGRGPGRPPAAKADETRKRILHAARQVFSERGYDGATFQEIAVRADLTRPAINHYF ANKRVLYQEVVEQTHELVIVAGIERARREPTLMGRLAVVVDFAMEADAQYPASTAFLATT VLESQRHPELSRTENDAVRATREFLVWAVNDAIERGELAADVDVSSLAETLLVVLCGVGF YIGFVGSYQRMATITDSFQQLLAGTLWRPPT >tr|I6YAB3|I6YAB3_MYCTU Iron ABC transporter permease OS=Mycobacterium tuberculosis (strain ATCC 25618 / H37Rv) GN=LH57_07380 PE=4 SV=1 MARGLQGVMLRSFGARDHTATVIETISIAPHFVRVRMVSPTLFQDAEAEPAAWLRFWFPD PNGSNTEFQRAYTISEADPAAGRFAVDVVLHDPAGPASSWARTVKPGATIAVMSLMGSSR FDVPEEQPAGYLLIGDSASIPGMNGIIETVPNDVPIEMYLEQHDDNDTLIPLAKHPRLRV RWVMRRDEKSLAEAIENRDWSDWYAWATPEAAALKCVRVRLRDEFGFPKSEIHAQAYWNA GRAMGTHRATEPAATEPEVGAAPQPESAVPAPARGSWRAQAASRLLAPLKLPLVLSGVLA ALVTLAQLAPFVLLVELSRLLVSGAGAHRLFTVGFAAVGLLGTGALLAAALTLWLHVIDA RFARALRLRLLSKLSRLPLGWFTSRGSGSIKKLVTDDTLALHYLVTHAVPDAVAAVVAPV GVLVYLFVVDWRVALVLFGPVLVYLTITSSLTIQSGPRIVQAQRWAEKMNGEAGSYLEGQ PVIRVFGAASSSFRRRLDEYIGFLVAWQRPLAGKKTLMDLATRPATFLWLIAATGTLLVA THRMDPVNLLPFMFLGTTFGARLLGIAYGLGGLRTGLLAARHLQVTLDETELAVREHPRE PLDGEAPATVVFDHVTFGYRPGVPVIQDVSLTLRPGTVTALVGPSGSGKSTLATLLARFH DVERGAIRVGGQDIRSLAADELYTRVGFVLQEAQLVHGTAAENIALAVPDAPAEQVQVAA REAQIHDRVLRLPDGYDTVLGANSGLSGGERQRLTIARAILGDTPVLILDEATAFADPES EYLVQQALNRLTRDRTVLVIAHRLHTITRADQIVVLDHGRIVERGTHEELLAAGGRYCRL WDTGQGSRVAVAAAQDGTR >tr|L0T545|L0T545_MYCTU PPE family protein PPE7 OS=Mycobacterium tuberculosis (strain ATCC 25618 / H37Rv) GN=PPE7 PE=4 SV=1 MSVCVIYIPFKGCVKHVSVTIPITTEHLGPYEIDASTINPDQPIDTAFTQTLDFAGSGTV GAFPFGFGWQQSPGFFNSTTTPSSGFFNSGAGGASGFLNDAAAAVSGLGNVFTETSGFFN AGGVGIRASKTSATCCRAGRT and another file containing the pattern like(Pattern.txt) I6WXB4 I6WXC3 I6WXK8 I need an output like >tr|I6WXB4|I6WXB4_MYCTU 30S ribosomal protein S6 OS=Mycobacterium tuberculosis (strain ATCC 25618 / H37Rv) GN=rpsF PE=3 SV=1 MRPYEIMVILDPTLDERTVAPSLETFLNVVRKDGGKVEKVDIWGKRRLAYEIAKHAEGIY VVIDVKAAPATVSELDRQLSLNESVLRTKVMRTDKH what I have done till now is grep -f Pattern.txt Input_fasta.txt How to extend the output to next lines till I hit next ">" after the match ? tried awk '/I6WXB4/{copy=1;next} />/{copy=0;next} copy' Input_fasta.txt which gave an output MRPYEIMVILDPTLDERTVAPSLETFLNVVRKDGGKVEKVDIWGKRRLAYEIAKHAEGIY VVIDVKAAPATVSELDRQLSLNESVLRTKVMRTDKH but header is missing here.
In awk: $ awk 'NR==FNR{a[$0]; next} $2 in a' pattern.txt FS="|" RS=">" input_fasta.tzt tr|I6WXB4|I6WXB4_MYCTU 30S ribosomal protein S6 OS=Mycobacterium tuberculosis (strain ATCC 25618 / H37Rv) GN=rpsF PE=3 SV=1 MRPYEIMVILDPTLDERTVAPSLETFLNVVRKDGGKVEKVDIWGKRRLAYEIAKHAEGIY VVIDVKAAPATVSELDRQLSLNESVLRTKVMRTDKH
Here’s a simple Python solution, using BioPython: import sys import re from Bio import SeqIO with open('pattern.txt', 'r') as f: patterns = '|'.join([re.escape(pattern.strip()) for pattern in f]) for record in SeqIO.parse('test.fa', 'fasta'): if re.search(patterns, record.id): SeqIO.write(record, sys.stdout, 'fasta') Note that this requires a well-behaved patterns.txt file, i.e. one that doesn’t contain any empty lines.
bash & sed solution: while read pattern do if [ ! -z $pattern ] ; then sed -n "/\|$pattern\|/{:loop;p;n;/>/q;bloop;}" input.txt fi done < patternfile.txt loops on pattern file (blank lines are skipped) and if finds the pattern, just read & print the file lines through the end or until it finds >
FFMPEG - Converting any kind of file to Mp4 compatible with IOS and Flash
I am struggling with FFmpeg within Drupal Video Module to produce files to MP4 that is compatible with IOS and Flash Player10 and up. I have used the following commands so far, please note that the variables starting with "!" are placeholders and will be replaces with the proper items: FFmpeg -strict experimental -y -i !videofile -pass 1 -s !widthx!height -b:v 500k -threads 0 -vcodec libx264 -vf "pad=!paddingwidth:!paddingheight:!paddingleft:!paddingtop:000000" -preset slow -an !convertfile FFmpeg -strict experimental -y -i !videofile -pass 2 -s !widthx!height -b:v 500k -threads 0 -vcodec libx264 -vf "pad=!paddingwidth:!paddingheight:!paddingleft:!paddingtop:000000" -preset slow -acodec aac -ab 128k !convertfile The above command produce an error as: error executing command for rendering preset HTML5 MP4, command #1: nice -n 19 /usr/bin/ffmpeg/ffmpeg -y -i '80137db8c3_1334836277_int_tr_19.mp4' -s 176x100 -b:v 500k -threads 0 -vcodec libx264 -preset slow -acodec aac -ab 128k '/converted/80137db8c3_1334836277_int_tr_19.mp4' 2>&1 Output: ffmpeg version git-2013-02-01-5a67e30 Copyright (c) 2000-2013 the FFmpeg developers built on Feb 1 2013 14:23:14 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 libavutil 52. 17.100 / 52. 17.100 libavcodec 54. 91.100 / 54. 91.100 libavformat 54. 61.104 / 54. 61.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 35.100 / 3. 35.100 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '80137db8c3_1334836277_int_tr_19.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2011-03-28 00:12:26 Duration: 00:02:01.14, start: 0.000000, bitrate: 703 kb/s Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 601 kb/s, 29.96 fps, 29.92 tbr, 1k tbn, 59.83 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s Metadata: creation_time : 2011-03-28 00:12:27 handler_name : (C) 2007 Google Inc. v08.13.2007. [libx264 # 0x34ec060] using SAR=100/99 [libx264 # 0x34ec060] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX [libx264 # 0x34ec060] profile High, level 2.0 [libx264 # 0x34ec060] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it. Alternatively use the non experimental encoder 'libfaac'. Another command that I used is: FFmpeg -i !videofile -an -pass 1 -vcodec libx264 -preset slow -b 500k -threads auto !convertfile FFMpeg -y -i !videofile -acodec libfaac -ab 128k -pass 2 -vcodec libx264 -preset slow -b 500k -threads auto !convertfile Output for the first pass: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'comiccon.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: mp41 creation_time : 2012-08-15 17:12:37 Duration: 01:17:15.93, start: 0.000000, bitrate: 706 kb/s Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 636 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc Metadata: creation_time : 2012-08-15 17:12:37 handler_name : VideoHandler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 63 kb/s Metadata: creation_time : 2012-08-15 17:12:37 handler_name : SoundHandler Please use -b:a or -b:v, -b is ambiguous using SAR=1/1 [libx264 # 0x1c39be0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX [libx264 # 0x1c39be0] profile Main, level 3.0 [libx264 # 0x1c39be0] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'comiccon.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: mp41 encoder : Lavf54.61.104 Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, pass 1, 500 kb/s, 15360 tbn, 30 tbc Metadata: creation_time : 2012-08-15 17:12:37 handler_name : VideoHandler Stream mapping: Stream #0:0 -> #0:0 (h264 -> libx264) Press [q] to stop, [?] for help frame=139078 fps=279 q=32766.0 Lsize= 286145kB time=01:17:15.86 bitrate= 505.6kbits/s video:284758kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.487000% [libx264 # 0x1c39be0] frame I:656 Avg QP:19.51 size: 21457 [libx264 # 0x1c39be0] frame P:76006 Avg QP:22.19 size: 3141 [libx264 # 0x1c39be0] frame B:62416 Avg QP:26.38 size: 621 [libx264 # 0x1c39be0] consecutive B-frames: 32.3% 17.5% 18.6% 31.6% [libx264 # 0x1c39be0] mb I I16..4: 24.5% 0.0% 75.5% [libx264 # 0x1c39be0] mb P I16..4: 7.5% 0.0% 0.0% P16..4: 40.5% 0.0% 0.0% 0.0% 0.0% skip:52.1% [libx264 # 0x1c39be0] mb B I16..4: 1.4% 0.0% 0.0% B16..8: 12.0% 0.0% 0.0% direct: 2.9% skip:83.7% L0:41.1% L1:41.6% BI:17.3% [libx264 # 0x1c39be0] final ratefactor: 23.45 [libx264 # 0x1c39be0] direct mvs spatial:95.3% temporal:4.7% [libx264 # 0x1c39be0] coded y,uvDC,uvAC intra: 37.6% 42.8% 11.8% inter: 8.9% 8.2% 0.5% [libx264 # 0x1c39be0] i16 v,h,dc,p: 43% 28% 19% 10% [libx264 # 0x1c39be0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 21% 11% 6% 4% 5% 4% 6% 6% [libx264 # 0x1c39be0] i8c dc,h,v,p: 57% 19% 20% 4% [libx264 # 0x1c39be0] Weighted P-Frames: Y:1.4% UV:0.5% [libx264 # 0x1c39be0] kb/s:503.18 output for the second pass: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'comiccon.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: mp41 creation_time : 2012-08-15 17:12:37 Duration: 01:17:15.93, start: 0.000000, bitrate: 706 kb/s Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 636 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc Metadata: creation_time : 2012-08-15 17:12:37 handler_name : VideoHandler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 63 kb/s Metadata: creation_time : 2012-08-15 17:12:37 handler_name : SoundHandler Please use -b:a or -b:v, -b is ambiguous [libx264 # 0x3247f80] using SAR=1/1 [libx264 # 0x3247f80] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX [libx264 # 0x3247f80] profile High, level 3.0 [libx264 # 0x3247f80] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=2pass mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'comiccon.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: mp41 encoder : Lavf54.61.104 Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, pass 2, 500 kb/s, 15360 tbn, 30 tbc Metadata: creation_time : 2012-08-15 17:12:37 handler_name : VideoHandler Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s Metadata: creation_time : 2012-08-15 17:12:37 handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (h264 -> libx264) Stream #0:1 -> #0:1 (aac -> libfaac) Press [q] to stop, [?] for help frame=139078 fps=206 q=32766.0 Lsize= 357252kB time=01:17:15.93 bitrate= 631.3kbits/s video:282992kB audio:69592kB subtitle:0 global headers:0kB muxing overhead 1.324238% [libx264 # 0x3247f80] frame I:656 Avg QP:19.61 size: 20433 [libx264 # 0x3247f80] frame P:76006 Avg QP:23.07 size: 2996 [libx264 # 0x3247f80] frame B:62416 Avg QP:26.23 size: 780 [libx264 # 0x3247f80] consecutive B-frames: 32.3% 17.5% 18.6% 31.6% [libx264 # 0x3247f80] mb I I16..4: 17.2% 37.8% 44.9% [libx264 # 0x3247f80] mb P I16..4: 2.9% 3.7% 1.2% P16..4: 30.3% 6.1% 3.4% 0.0% 0.0% skip:52.5% [libx264 # 0x3247f80] mb B I16..4: 0.5% 0.6% 0.3% B16..8: 25.9% 2.2% 0.5% direct: 0.9% skip:69.3% L0:51.4% L1:43.0% BI: 5.7% [libx264 # 0x3247f80] 8x8 transform intra:45.9% inter:51.5% [libx264 # 0x3247f80] direct mvs spatial:85.5% temporal:14.5% [libx264 # 0x3247f80] coded y,uvDC,uvAC intra: 47.3% 49.2% 13.5% inter: 9.0% 9.4% 0.5% [libx264 # 0x3247f80] i16 v,h,dc,p: 38% 27% 13% 22% [libx264 # 0x3247f80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 16% 14% 5% 5% 7% 7% 8% 9% [libx264 # 0x3247f80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 15% 9% 6% 7% 8% 7% 8% 8% [libx264 # 0x3247f80] i8c dc,h,v,p: 49% 22% 20% 8% [libx264 # 0x3247f80] Weighted P-Frames: Y:1.4% UV:0.5% [libx264 # 0x3247f80] ref P L0: 79.3% 10.4% 6.8% 1.6% 1.2% 0.7% 0.0% [libx264 # 0x3247f80] ref B L0: 93.6% 4.8% 1.2% 0.3% [libx264 # 0x3247f80] ref B L1: 96.6% 3.4% [libx264 # 0x3247f80] kb/s:500.06 The above command produces the file correctly however it cannot be played in flash player. One thing that I noticed is this may happen if the input file is mp4 as well. This command is executed for users uploading files, so the input file could be any format. Below is the information about my FFmpeg version: > ffmpeg version git-2013-02-01-5a67e30 Copyright (c) 2000-2013 the > FFmpeg developers built on Feb 1 2013 14:23:14 with gcc 4.6 > (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-gpl > --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 libavutil 52. 17.100 / 52. 17.100 libavcodec 54. 91.100 / 54. 91.100 libavformat 54. 61.104 / 54. 61.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 35.100 / 3. 35.100 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.1
Some notes: The binary is ffmpeg; not FFmpeg or FFMpeg. -strict experimental should be used as an output option. You are using it as an input option and is being ignored. You won't need it for other AAC encoders. -threads auto is now default and adding it is superfluous. You compiled with --enable-libfdk-aac, and therefore you can use -codec:a libfdk_aac which will provide better quality per file size than the other AAC encoders. See the FFmpeg AAC Encoding Guide and FFmpeg and x264 Encoding Guide. The message Please use -b:a or -b:v, -b is ambiguous should not be ignored so ffmpeg knows if you want to apply your desired bitrate to the audio or video. I don't see why the second command shouldn't work in a flash player. You may simply not be waiting long enough for the file to download completely before playing. You can add -movflags +faststart to allow playback to begin before the download completes. Replace -s with the scale filter so you can have a proper filterchain with pad. Next time show actual commands and not commands with variables; otherwise I could have given a proper filtering example.
What are the specifications of Flex usable FLV videos?
I have a server which streams FLV files to a Flex client. In this flex client, the video timeline advances incoherently, and no video can be seen on screen (only the sound can be heard). My FLV file has been generated using ffmpeg, which says (about this generated file) FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers built on Aug 8 2010 04:24:04 with gcc 4.3.2 configuration: --prefix=/home/marpada/ffmpegfull --enable-gpl --enable-version3 --enable-nonfree --disable-ffplay --disable-ffserver --enable-libmp3lame --enable-libfaac --enable-libvpx --enable-libfaad --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxvid --enable-libx264 --enable-libtheora --extra-ldflags=-static --extra-libs='-lvorbis -logg -lxvidcore -lx264 -lopencore-amrnb -lopencore-amrwb -lfaad -lfaac -lvpx -ltheora -lm -lpthread' --enable-small --enable-runtime-cpudetect libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0.11. 0 / 0.11. 0 [flv # 0x95c6aa0]Estimating duration from bitrate, this may be inaccurate Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1) Input #0, flv, from '/appli/perigee_70ri/data/files/ged_bur%0/Imagettes/70ri/279/2/8/20_109021138o.70ri_FLV_preview_.flv': Metadata: hasMetadata : true hasVideo : true hasAudio : true duration : 589 lasttimestamp : 589 lastkeyframetimestamp: 589 width : 352 height : 288 videodatarate : 199 framerate : 25 audiodatarate : 125 audiosamplerate : 44100 audiosamplesize : 16 stereo : true filesize : 25058444 videosize : 15195503 audiosize : 9690850 datasize : 23027 metadatacreator : flvmeta 1.1-r202 audiocodecid : 2 videocodecid : 2 audiodelay : 0 canSeekToEnd : false hasCuePoints : false hasKeyframes : true Duration: 00:09:48.78, start: 0.000000, bitrate: 332 kb/s Stream #0.0: Video: flv, yuv420p, 352x288, 204 kb/s, 25 tbr, 1k tbn, 1k tbc Stream #0.1: Audio: mp3, 44100 Hz, 2 channels, s16, 128 kb/s At least one output file must be specified Which, as far as it seems to me, is OK. Furthermore, the video plays nice in VLC.
Use H.264 for the video stream.