Ticket #1970 (open defect)

Opened 6 months ago

Last modified 6 weeks ago

ffserver ignores ffmpeg command line arguments

Reported by: importinis Owned by:
Priority: important Component: FFserver
Version: git-master Keywords: regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I'm trying to transcode from mpegts to flv. In mpegts are 2 audio streams but I want to transcode just one, and igore the other.

 http://pastebin.com/EMu5WS7Z

please notice, that there is 2 examples:

  1. ffmpeg writes to file - audio stream mapping works great.
  2. ffserver ignores audio stream specified by ffmpeg and transcodes first one, not specified.

The problem: ffserver ignores ffmpeg arguments! In this example it's obvious that ignores -map argument, but if I specify video filters - ffserver ignores as well.

Change History

comment:1 Changed 6 months ago by cehoyos

  • Priority changed from critical to normal

Please post all necessary information here on the tracker, please try to avoid external resources.
Is the problem also reproducible with current git head? Is it a regression?

comment:2 follow-up: ↓ 3 Changed 6 months ago by importinis

This bug I noticed than upgraded from 1years old ffmpeg version :)

* TEST1 - ffmpeg with map arguments and writing to file

# ffmpeg -i http://10.2.3.14:9050/233.239.0.66  -map 0:2 -map 0:0 -c copy /tmp/tofile.ts
ffmpeg version N-46531-g7693543 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov  9 2012 11:36:04 with gcc 4.4.5 (Debian 4.4.5-8)
  configuration: --prefix=/usr/local --enable-nonfree --enable-gpl --enable-runtime-cpudetect --disable-ffprobe --disable-ffplay --disable-devices --enable-libmp3lame --enable-libx264 --disable-protocols --enable-protocol=http --enable-protocol=udp --enable-protocol=file --disable-hwaccels
  libavutil      52.  5.100 / 52.  5.100
  libavcodec     54. 71.100 / 54. 71.100
  libavformat    54. 36.100 / 54. 36.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 21.106 /  3. 21.106
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
[mpegts @ 0x2e22240] max_analyze_duration 5000000 reached at 5016000
[mpegts @ 0x2e22240] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegts, from 'http://10.2.3.14:9050/233.239.0.66':
  Duration: N/A, start: 23737.567233, bitrate: 384 kb/s
  Program 1850
    Stream #0:0[0x73b]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x73e](rus): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 192 kb/s
    Stream #0:2[0x73f](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 192 kb/s
Output #0, mpegts, to '/tmp/tofile.ts':
  Metadata:
    encoder         : Lavf54.36.100
    Stream #0:0(eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, 192 kb/s
    Stream #0:1: Video: mpeg2video ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 25 fps, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:2 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  212 fps= 58 q=-1.0 Lsize=    4071kB time=00:00:08.88 bitrate=3754.8kbits/s
video:3558kB audio:200kB subtitle:0 global headers:0kB muxing overhead 8.323952%

Notice Stream #0:2 -> #0:0 (copy) 0:2 -> 0:0 Thats OK.

* TEST2 - ffmpeg with map arguments and feeding to ffserver

#ffmpeg -i http://10.2.3.14:9050/233.239.0.66 -map 0:2 -map 0:0 http://127.0.0.1:1200/stream.ffm
ffmpeg version N-46531-g7693543 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov  9 2012 11:36:04 with gcc 4.4.5 (Debian 4.4.5-8)
  configuration: --prefix=/usr/local --enable-nonfree --enable-gpl --enable-runtime-cpudetect --disable-ffprobe --disable-ffplay --disable-devices --enable-libmp3lame --enable-libx264 --disable-protocols --enable-protocol=http --enable-protocol=udp --enable-protocol=file --disable-hwaccels
  libavutil      52.  5.100 / 52.  5.100
  libavcodec     54. 71.100 / 54. 71.100
  libavformat    54. 36.100 / 54. 36.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 21.106 /  3. 21.106
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
[mpeg2video @ 0x2a69a40] mpeg_decode_postinit() failure
    Last message repeated 10 times
[mpegts @ 0x2a63240] max_analyze_duration 5000000 reached at 5016000
[mpegts @ 0x2a63240] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegts, from 'http://10.2.3.14:9050/233.239.0.66':
  Duration: N/A, start: 23860.207222, bitrate: 384 kb/s
  Program 1850
    Stream #0:0[0x73b]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x73e](rus): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 192 kb/s
    Stream #0:2[0x73f](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 192 kb/s
[libx264 @ 0x2b1aea0] using SAR=1/1
[libx264 @ 0x2b1aea0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x2b1aea0] profile High, level 4.1
[libx264 @ 0x2b1aea0] 264 - core 128 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=5 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 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=0 weightp=2 keyint=25 keyint_min=13 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=640 ratetol=1.0 qcomp=0.50 qpmin=10 qpmax=51 qpstep=4 vbv_maxrate=800 vbv_bufsize=41943 nal_hrd=none ip_ratio=1.40 aq=1:1.00
Output #0, ffm, to 'http://127.0.0.1:1200/stream.ffm':
  Metadata:
    creation_time   : now
    encoder         : Lavf54.36.100
    Stream #0:0(rus): Audio: mp3, 44100 Hz, mono, s32p, 64 kb/s
    Stream #0:1: Video: h264, yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=10-51, 640 kb/s, 1000k tbn, 25 tbc
Stream mapping:

  Stream #0:1 -> #0:0 (mp2 -> libmp3lame)
  Stream #0:0 -> #0:1 (mpeg2video -> libx264)
Press [q] to stop, [?] for help

Notice Stream #0:1 -> #0:0 (mp2 -> libmp3lame) audio stream picked first, despite of -map 0:2! Thats not OK.

* FFSERVER config

Port 1200
#######################################
<Feed stream.ffm>
    File /dev/shm/1200.ffm
    FileMaxSize 5M
</Feed>
 
 
<Stream stream.flv>
Feed stream.ffm
Format flv
 
 
VideoCodec libx264
VideoBitRate 640k
VideoBufferSize 5120k
VideoFrameRate 25
VideoSize 640x480
AVPresetVideo lossless_medium
AVOptionVideo flags +global_header
 
 
AudioCodec libmp3lame
AudioBitRate 64k
AudioChannels 1
AudioSampleRate 44100
 
#i tried to uncomment - results the same AVOptionAudio map 0:2
 
AVOptionAudio flags +global_header
 
 
Preroll 5
StartSendOnKey
</Stream>
Last edited 6 months ago by cehoyos (previous) (diff)

comment:3 in reply to: ↑ 2 Changed 6 months ago by cehoyos

  • Keywords regression added
  • Priority changed from normal to important
  • Version changed from 1.0 to git-master

Replying to importinis:

This bug I noticed than upgraded from 1years old ffmpeg version :)

Do you know which version was working for you?

Isn't this a duplicate of ticket #1930 ?

comment:4 follow-up: ↓ 5 Changed 6 months ago by importinis

With latest git version(ffmpeg version N-47120-g8aa6d89) the issue reproduces.

The working version is of Libav developers:
FFmpeg version git-4c64c8e, Copyright (c) 2000-2011 the Libav developers. I got this git link from ffmpeg.org

#1930 ticket is similar, but ffserver ignores not only vf arguments, it ignores any... :)

comment:5 in reply to: ↑ 4 Changed 6 months ago by cehoyos

Replying to importinis:

The working version is of Libav developers:
FFmpeg version git-4c64c8e, Copyright (c) 2000-2011 the Libav developers.

Does c407984 not work?

comment:6 follow-up: ↓ 7 Changed 6 months ago by importinis

Yes, c407984 works.

# ffmpeg -f mpegts -i http://10.2.3.14:9050/233.239.0.66 -loglevel debug -vf "yadif=0:-1:1" -map 0:2 -map 0:0 -acodec libmp3lame -ar 44100 -ac 2 -ab 96k -vcodec libx264 -preset medium -tune zerolatency -vb 640k -s 640x480 -r 25  -f ffm  http://127.0.0.1:1999/stream.ffm
FFmpeg version git-N-29167-gc407984, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov 27 2012 11:47:45 with gcc 4.4.5
  configuration: --prefix=/usr/local --enable-gpl --enable-pthreads --enable-libmp3lame --enable-nonfree --disable-ffplay --disable-devices --disable-ffprobe --enable-postproc --enable-avfilter --enable-runtime-cpudetect --enable-libx264
  libavutil    50. 40. 1 / 50. 40. 1
  libavcodec   52.120. 0 / 52.120. 0
  libavformat  52.108. 0 / 52.108. 0
  libavdevice  52.  4. 0 / 52.  4. 0
  libavfilter   1. 79. 0 /  1. 79. 0
  libswscale    0. 13. 0 /  0. 13. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mpeg2video @ 0x1608150] mpeg_decode_postinit() failure
    Last message repeated 3 times
[mpegts @ 0x15e8660] max_analyze_duration reached
[mpegts @ 0x15e8660] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegts, from 'http://10.2.3.14:9050/233.239.0.66':
  Duration: N/A, start: 33457.519222, bitrate: 15384 kb/s
  Program 1850
    Stream #0.0[0x73b]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 16:15 DAR 4:3], 15000 kb/s, 25.40 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x73e](rus): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
    Stream #0.2[0x73f](eng): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
Probed with size=2048 and score=101
[buffer @ 0x1609cf0] w:720 h:576 pixfmt:yuv420p
[scale @ 0x160a040] w:720 h:576 fmt:yuv420p -> w:640 h:480 fmt:yuv420p flags:0x4
[libx264 @ 0x160f3c0] using SAR=16/15
[libx264 @ 0x160f3c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x160f3c0] profile Main, level 4.1
Output #0, ffm, to 'http://127.0.0.1:1999/stream.ffm':
  Metadata:
    encoder         : Lavf52.108.0
    Stream #0.0(eng), 0, 1/1000000: Audio: libmp3lame, 44100 Hz, 1 channels, s16, 64 kb/s
    Stream #0.1, 0, 1/1000000: Video: libx264, yuv420p, 640x480 [PAR 16:15 DAR 64:45], 1/25, q=10-51, 640 kb/s, 1000k tbn, 25 tbc
Stream mapping:
  Stream #0.2 -> #0.0
  Stream #0.0 -> #0.1
Press [q] to stop encoding
Last edited 6 months ago by cehoyos (previous) (diff)

comment:7 in reply to: ↑ 6 Changed 6 months ago by cehoyos

Replying to importinis:

Yes, c407984 works.

If you want to help, please use git bisect to find the change introducing the regression.

comment:8 Changed 6 months ago by importinis

git bisect start
# good: [c40798441f47341c310b38e8f329cfb943924faf] Merge remote branch 'qatar/master'
git bisect good c40798441f47341c310b38e8f329cfb943924faf
# bad: [769354348a3acddb36582277a7d3f26e6d179369] PRINT_CODEC_SUPPORTED: fix used variable
git bisect bad 769354348a3acddb36582277a7d3f26e6d179369
# bad: [175ab5f9a923343dbeb3914a185c223c43702d95] lavfi/*showinfo: use av_ts2* macros in showinfo and ashowinfo
git bisect bad 175ab5f9a923343dbeb3914a185c223c43702d95
# skip: [1e4d60353cdb50619bc39d78f84afe961d013fae] vc1: disable parts of the interlaced code due to security issues.
git bisect skip 1e4d60353cdb50619bc39d78f84afe961d013fae
# good: [53d5cd2c8225e251826c77f8f69a30250038fbd0] mov: Support Digital Voodoo SD 8 Bit and DTS codec identifiers.
git bisect good 53d5cd2c8225e251826c77f8f69a30250038fbd0
# skip: [9e8dff90efa3faae5ac07fa5fae7e154367e24fd] Revert "mov: do not misreport empty stts"
git bisect skip 9e8dff90efa3faae5ac07fa5fae7e154367e24fd
# skip: [182cbe433aea20b0d9627d40de7c75713ec736db] avtools: parse loglevel before all the other options.
git bisect skip 182cbe433aea20b0d9627d40de7c75713ec736db
# bad: [2dd7a1c030e64cdd8fed18e2530fb5b95f41b990] swscale: Split C input functions into separate file.
git bisect bad 2dd7a1c030e64cdd8fed18e2530fb5b95f41b990
# bad: [c4b97fbdfabb9d252a13c9c1f7bc8e1c2e9e43c5] pulse: documentation
git bisect bad c4b97fbdfabb9d252a13c9c1f7bc8e1c2e9e43c5
# bad: [5d06f15235c2fa1b6ed2c5af3bc0e3750df4291c] libx264: set default thread count to 0 (auto)
git bisect bad 5d06f15235c2fa1b6ed2c5af3bc0e3750df4291c
# good: [55eda370cb6fe9e4c21539f3f90fd940fcf7a103] swscale: clip unscaled colorspace conversion path.
git bisect good 55eda370cb6fe9e4c21539f3f90fd940fcf7a103
# good: [bac3ab13ea6a9dd8853e79ef3eacf51d234c8774] h264: notice memory allocation failure
git bisect good bac3ab13ea6a9dd8853e79ef3eacf51d234c8774
# good: [bb337b4fbceb6af7f70ef2f9476733cc2fa5350b] avconv: Fix spelling errors.
git bisect good bb337b4fbceb6af7f70ef2f9476733cc2fa5350b
# good: [d2ba1fb50c72ee8bb92111cd32453b741c545769] configure: fix typo in avconv dependency list
git bisect good d2ba1fb50c72ee8bb92111cd32453b741c545769
# good: [0f29699db73d569307cac1abce64ae43647db2d2] libx264: add 'weightb' private option.
git bisect good 0f29699db73d569307cac1abce64ae43647db2d2
# good: [38934f19fe624270fabf32a411d84f1fee3e0aae] libx264: add 'psy' private option.
git bisect good 38934f19fe624270fabf32a411d84f1fee3e0aae
# skip: [9bb2d1a3f0ea3595fafad32d6ee1261506f57bb4] h263p encoder: add 'umv' private option.
git bisect skip 9bb2d1a3f0ea3595fafad32d6ee1261506f57bb4
# skip: [4bcee8e7f826b79206da660cd66ad91e497d7184] h263/p encoder: add 'structured_slices' private option.
git bisect skip 4bcee8e7f826b79206da660cd66ad91e497d7184
# bad: [0e5d37309f54f4377ec1f1a7ca41ea06d4ade923] mpeg12enc/mpeg4videoenc: add 'alternate_scan' private option.
git bisect bad 0e5d37309f54f4377ec1f1a7ca41ea06d4ade923
# bad: [0cc06b9e23bc798b1af3302d095db23f000a97e6] snow: add 'memc_only' private option.
git bisect bad 0cc06b9e23bc798b1af3302d095db23f000a97e6

some version I've skipped because of making errors. I hope It will help to bugfix

comment:9 Changed 6 months ago by cehoyos

Your results are not completely conclusive.
Please test 0ed7bc4 and a9c6936.

comment:10 Changed 6 months ago by importinis

0ed7bc4: then I try to feed ffserver, i get segmentation fault
# ffmpeg -i  http://10.2.3.14:9050/233.239.0.69 -map 0:2 -map 0:0  http://127.0.0.1:1999/stream.ffm
ffmpeg version N-32258-g0ed7bc4, Copyright (c) 2000-2011 the FFmpeg developers

built on Nov 27 2012 23:13:00 with gcc 4.4.5
configuration: --prefix=/usr/local --enable-gpl --enable-pthreads --enable-lib mp3lame --enable-nonfree --disable-devices --enable-postproc --enable-avfilter - -enable-runtime-cpudetect --enable-libx264
libavutil 51. 14. 0 / 51. 14. 0
libavcodec 53. 12. 0 / 53. 12. 0
libavformat 53. 10. 0 / 53. 10. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 37. 0 / 2. 37. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0

[mpeg2video @ 0x2833760] mpeg_decode_postinit() failure
[mpegts @ 0x282c420] max_analyze_duration 5000000 reached at 5000000
[mpegts @ 0x282c420] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegts, from ' http://10.2.3.14:9050/233.239.0.69':

Duration: N/A, start: 54421.190778, bitrate: 15384 kb/s
Program 1860

Stream #0.0[0x745]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0.1[0x748](ru): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 192 kb/s
Stream #0.2[0x749]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 192 kb/s

[buffer @ 0x2b0a3c0] w:720 h:576 pixfmt:yuv420p tb:1/1000000 sar:64/45 sws_param:
Segmentation fault

a9c6936: I dont know the reason, but then I try to feed ffserver ffmpeg exits.

# ffmpeg -i  http://10.2.3.14:9050/233.239.0.66 -loglevel debug -map 0:2 -map 0:0  http://127.0.0.1:1999/stream.ffm
ffmpeg version N-32226-ga9c6936, Copyright (c) 2000-2011 the FFmpeg developers

built on Nov 27 2012 23:30:11 with gcc 4.4.5
configuration: --prefix=/usr/local --enable-gpl --enable-pthreads --enable-libmp3lame --enable-nonfree --disable-devices --enable-postproc --enable-avfilter --enable-runtime-cpudetect --enable-libx264
libavutil 51. 14. 0 / 51. 14. 0
libavcodec 53. 12. 0 / 53. 12. 0
libavformat 53. 10. 0 / 53. 10. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 37. 0 / 2. 37. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0

[mpeg2video @ 0x1c17760] mpeg_decode_postinit() failure

Last message repeated 2 times

[mpegts @ 0x1c10420] max_analyze_duration 5000000 reached at 5016000
[mpegts @ 0x1c10420] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegts, from ' http://10.2.3.14:9050/233.239.0.66':

Duration: N/A, start: 15700.217533, bitrate: 15384 kb/s
Program 1850

Stream #0.0[0x73b]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 15000 kb/s, 25.20 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0.1[0x73e](rus): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 192 kb/s
Stream #0.2[0x73f](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 192 kb/s

[ffm @ 0x1c170c0] Format ffm probed with size=2048 and score=101
Aborted

comment:11 Changed 6 months ago by cehoyos

  • Status changed from new to open
  • Reproduced by developer set

Last working revision was 896e597, regression since bb258fb / 1cede1d

comment:12 follow-up: ↓ 13 Changed 6 months ago by importinis

Is there anything I could help?

comment:13 in reply to: ↑ 12 Changed 6 months ago by cehoyos

Replying to importinis:

Is there anything I could help?

You helped very much by allowing me to find the version that introduced the regression.

The only thing you could do is to send a patch that fixes the bug;-)

comment:14 Changed 6 months ago by importinis

I hope you do this :)

comment:15 Changed 6 months ago by importinis

Hello,

I know you are busy, but I want answer :) When you are planing to fix this bug?
I could do donation to your community if it helps to fix it quicker :)

comment:16 Changed 4 months ago by rickvanderzwet

Whould a workaround be to filter first and then pipe the output to the ffmpeg instance which does the 'distribution' to ffserver? Like this:

./bin/ffmpeg -y -i rtsp://172.17.20.5/live/ch01_0 -vf "$FILTER" -f avi pipe:1 | ./bin/ffmpeg -y -i pipe:0 foo.mp4 foo.webm

comment:17 Changed 6 weeks ago by importinis

any progress per 5 months ?

Note: See TracTickets for help on using tickets.