diff --git a/examples/overlay.py b/examples/overlay.py
index 800fa90..a7926c7 100644
--- a/examples/overlay.py
+++ b/examples/overlay.py
@@ -11,7 +11,7 @@ overlay = ff.video | Overlay(x=1720, y=100)
 # scale logo to 100x100 and pass as top layer to overlay filter
 logo | Scale(width=100, height=100) | overlay
 
-# tell ffmpeg that it'll output something to destination file
-output = ff > output_file('output.mp4')
 # output video with logo to destination file
-overlay > output
+output = overlay > output_file('output.mp4', VideoCodec('libx264'))
+# tell ffmpeg that it'll output something to destination file
+ff > output
diff --git a/fffw/encoding/outputs.py b/fffw/encoding/outputs.py
index 267c59d..4d0e471 100644
--- a/fffw/encoding/outputs.py
+++ b/fffw/encoding/outputs.py
@@ -110,7 +110,7 @@ class Output(BaseWrapper):
     format: str = param(name="f")
     output_file: str = param(name="", skip=True)
 
-    def __lt__(self, other: base.InputType) -> Codec:
+    def __lt__(self, other: base.InputType) -> "Output":
         """
         Connects a source or a filter to a first free codec.
 
@@ -118,7 +118,7 @@ class Output(BaseWrapper):
         """
         codec = self.get_free_codec(other.kind)
         other.connect_dest(codec)
-        return codec
+        return self
 
     @property
     def video(self) -> Codec:

diff --git a/tests/test_ffmpeg.py b/tests/test_ffmpeg.py
index dcb2105..10e52e3 100644
--- a/tests/test_ffmpeg.py
+++ b/tests/test_ffmpeg.py
@@ -493,3 +493,19 @@ class FFMPEGTestCase(BaseTestCase):
         ff > output
 
         ff.check_buffering()
+
+    def test_shortcut_outputs_with_codec(self):
+        """ Check ff > output shortcut if codecs list specified."""
+        ff = FFMPEG(input=inputs.input_file("input.mp4"))
+        scaled = ff.video | filters.Scale(width=1280, height=720)
+
+        with self.assertRaises(RuntimeError):
+            codec = codecs.VideoCodec("libx264")
+            out = ff > outputs.output_file("output.mp4", codec)
+            # at this moment codec is connected to ffmpeg input stream directly
+            # so scaled video stream could not be connected to output
+            scaled > out
+
+        codec = codecs.VideoCodec("libx264")
+        out = scaled > outputs.output_file("output.mp4", codec)
+        ff > out

FFMPEG.add_output shortcuts imisbehaving
```
output = ff > output_file('output.mp4', VideoCodec('libx264'))

stream > output
```
The code above does not work because second line raises "no free codecs" error.

Relates to #43
tests/test_ffmpeg.py::FFMPEGTestCase::test_shortcut_outputs_with_codec
tests/test_ffmpeg.py::FFMPEGTestCase::test_bypass_with_filter_complex tests/test_ffmpeg.py::FFMPEGTestCase::test_bypass_without_filter_complex tests/test_ffmpeg.py::FFMPEGTestCase::test_concat tests/test_ffmpeg.py::FFMPEGTestCase::test_detect_concat_buffering tests/test_ffmpeg.py::FFMPEGTestCase::test_detect_trim_buffering tests/test_ffmpeg.py::FFMPEGTestCase::test_ffmpeg tests/test_ffmpeg.py::FFMPEGTestCase::test_fix_preroll_buffering_with_trim tests/test_ffmpeg.py::FFMPEGTestCase::test_handle_codec_copy tests/test_ffmpeg.py::FFMPEGTestCase::test_handle_codec_copy_with_other_filters tests/test_ffmpeg.py::FFMPEGTestCase::test_input_stream_naming tests/test_ffmpeg.py::FFMPEGTestCase::test_no_audio_if_no_codecs_found tests/test_ffmpeg.py::FFMPEGTestCase::test_reuse_input_files tests/test_ffmpeg.py::FFMPEGTestCase::test_transcoding_without_graph